Bug 961271 - Part 1: Write BCD chars. r=vicamo, a=1.3+
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 27 Jan 2014 14:24:57 +0800
changeset 176040 c491444042dc8760ba1eb172fefe462507d9e6a4
parent 176039 b7124d82a8ef5d782e29cd479742a69c521187ee
child 176041 a581d53d51f47a756f5c245196d7b2c72471ee77
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo, 1
bugs961271
milestone28.0a2
Bug 961271 - Part 1: Write BCD chars. r=vicamo, a=1.3+
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -9547,16 +9547,23 @@ let ICCPDUHelper = {
     }
 
     return number;
   },
 
   writeNumberWithLength: function writeNumberWithLength(number) {
     if (number) {
       let numStart = number[0] == "+" ? 1 : 0;
+      number = number.substring(0, numStart) +
+               number.substring(numStart)
+                     .replace(/[^0-9*#,]/g, "")
+                     .replace(/\*/g, "a")
+                     .replace(/\#/g, "b")
+                     .replace(/\,/g, "c");
+
       let numDigits = number.length - numStart;
       if (numDigits > ADN_MAX_NUMBER_DIGITS) {
         number = number.substring(0, ADN_MAX_NUMBER_DIGITS + numStart);
         numDigits = number.length - numStart;
       }
 
       // +1 for TON/NPI
       let numLen = Math.ceil(numDigits / 2) + 1;