PDA

View Full Version : Problem with some utf8 characters on store



simcamil
29 Apr 2015, 5:17 AM
Hello,

I am trying to read some data in a database that has passwords encoded in SHA1. This causes that some characters are special characters.

In my ExtJS store, I have a proxy that reads data from a database in JSON format. The problem is that when the SHA1 passwords have some strange characters, the store doesn't process correctly those records. For example, these are some utf8 characters that create this problem: u0011, u0004, u0014

The data comes from a PHP script and I have verified that it is sent correctly.

Why does extjs have problems with this characters?

This causes a problem because I need to read from the database a SHA1 string and then write it back exactly the same. If I do an utf8_encode I get this characters converted. For example, if I have j(it~$% (there are 2 special characters at the start of the string that are invisible) the utf8_encoding/decoding process returns u001du0007j(it~$%

Thank you

tristan.lee
29 Apr 2015, 1:55 PM
Hi,

In your application, try setting the following:


Ext.USE_NATIVE_JSON = true;
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-property-USE_NATIVE_JSON

Hope this helps,
Tristan

simcamil
29 Apr 2015, 1:58 PM
Hi,

Thanks for the tip but I already have that parameter set to true. That solves the issue for most of the utf8 encoded characters but there are some characters that are still not correctly set. What I've seen is that this usually happens with characters that don't have an ASCII representation.

tristan.lee
29 Apr 2015, 2:14 PM
Can you post the string you are having issue with in CODE blocks so I can reproduce the issue, or better yet provide a fiddle yourself (https://fiddle.sencha.com) so I can walk through the exact issue you're encountering.Thanks,Tristan