Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-13600

BlackBerry: JSON Parser is not parsing extended character like used in Arabic correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: BlackBerry
    • Labels:
      None

      Description

      var MyGlobalVars = {
      token: null,
      userid: null,
      city: null
      };
       
      // create first window - login window -
      // if success in login redirect to home window
      var windowLogin = Ti.UI.createWindow({
      backgroundColor : "#A8111B",
      });
      // create form login
      var username = Ti.UI.createTextField({
      color : '#336699',
      top : 10,
      width : 200,
      textAlign : 'center',
      height : 40,
      hintText : 'اسم المستخدم'
      });
       
      var password = Ti.UI.createTextField({
      color : '#336699',
      top : 40,
      width : 200,
      height : 40,
      textAlign : 'center',
      passwordMask : true,
      hintText : 'كلمة المرور'
       
      });
       
      var buttonLogin = Ti.UI.createButton({ title : 'تسجيل الدخول', textAlign : 'center', top : 90, height : 40, width : 100, right : 20 });
       
      var buttonRegister = Ti.UI.createButton({ title : 'مستخدم جديد', textAlign : 'center', top : 130, height : 40, width : 100, right : 20 });
       
      var buttonForget = Ti.UI.createButton({ title : 'نسيت كلمة المرور', textAlign : 'center', top : 170, width : 100, height : 40, right : 20 });
       
      // redirect to show window on click
      buttonRegister.addEventListener("click", function() { Titanium.include('ui/register.js'); });
       
      // redirect to show window on click
      buttonForget.addEventListener("click", function() { Titanium.include('ui/forget.js'); });
       
      var loginReq = Titanium.Network.createHTTPClient();
      buttonLogin.addEventListener('click', function(e) {
       
      if (username.value != '' && password.value != '') {
      loginReq.open("POST", "http://demoo.smaris.net/keftaltareq/user_json/login");
      var params = { username : username.value, password : password.value };
      loginReq.send(params);
       
      } else { alert("username and password are required"); }
       
      });
       
      loginReq.onload = function() {
       
      var json = this.responseText;
      var response = JSON.parse(json);
      if (response.success == 1) { //windowLogin.close() MyGlobalVars.token = response.token; MyGlobalVars.userid = response.id; Titanium.include('ui/index.js'); } else if (response.success == 2) { alert("خطأ باسم المستخدم أو كلمة المرور"); }
       
      };
       
      windowLogin.add(username);
      windowLogin.add(password);
      windowLogin.add(buttonLogin);
      windowLogin.add(buttonRegister);
      windowLogin.add(buttonForget);
       
      windowLogin.open();
       
      // and this is my code for data returned from server
       
      openCityBtn.addEventListener('click', function(e) {
      var getCity = Titanium.Network.createHTTPClient({
      onerror : function(e) { Ti.API.debug(e.error); alert('حدث خطأ اثناء الاتصال'); },
      timeout : 5000,
      });
       
      getCity.open('GET', 'http://demoo.smaris.net/keftaltareq/user_json/city_blackberry/' + MyGlobalVars.userid + '/' + MyGlobalVars.token);
      getCity.send();
      getCity.onload = function() {
      var json = JSON.parse(this.responseText);
      dataArray = [];
      for (var i = 0; i < json.length; i++) {
      var row = Ti.UI.createTableViewRow({ title : json[i].city_name_en });
      dataArray.push(row);
      };
      tableX.setData(dataArray);
      };
       
      var view = Titanium.UI.createView({ backgroundColor : '#3D3D3D', borderColor : '#fff', borderWidth : 4, width : 200, top : 5, height : 150 });
       
      var tableX = Titanium.UI.createTableView({ backgroundColor : 'transparent', separatorColor : 'black', textAlign : 'right', });
       
      view.add(tableX);
      winHome.add(view);
       
      tableX.addEventListener('click', function(e) { view.hide(tableX); MyGlobalVars.city = e.rowData.title; });
       
      });
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joshroesslein Josh Roesslein
                Reporter:
                rmcmahon Russell McMahon
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-16272
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration