unterminated string literal on json eval

Posted by sonam on Stack Overflow See other posts from Stack Overflow or by sonam
Published on 2010-05-31T11:20:24Z Indexed on 2010/05/31 11:22 UTC
Read the original article Hit count: 312

Filed under:
|
|

I am trying to eval() a json having speacial characters - 
 and getting "unterminated string literal" error in Firefox 3.5.9 Although the same works fine on IE. 7. I have set the character encoding to UTF-8 in both the browsers. Any idea why its an error in FF?

Also right before converting the String to JSON, I ran this code in java

String jsonString = //some json string having 

for(byte b : jsonString.getBytes()){
    System.out.print(Integer.toHexString(b) + " ");
}
net.sf.json.JSON jsonObject = net.sf.json.JSONSerializer.toJSON(jsonString);

And the o/p for above characters is

ffffffe2 ffffff80 ffffffa8 respectively. How do I know if these are valid UTF-8 characters?

© Stack Overflow or respective owner

Related posts about internet-explorer

Related posts about firefox