bulknews.typepad.com
Tatsuhiko Miyagawa's blog to discuss mostly tech and nerdy stuff.
Home
Home
Archives
Profile
Subscribe
2009.02.18
NOFX Bob
NOFX Bob
2009/02/15 at Slim's
Feb 18, 2009 4:30:48 PM
NEXT POST
JSON, jQuery and some Unicode characters (U+2028)
You have a web application that generates JSON dynamically from the data in your database, which probably comes from the cloud. Your data might have some weird strings, like U+2028 the Unicode LINE SEPARATOR character. When you use Perl's JSON::XS, or probably other JSON encoder modules as well, it gives you an UTF-8 JSON data like this: {"text":"Foo[\xe2\x80\xa8]Bar"} Note that this [\xe2\x80\xa8] stands for 3-byte strings that represent UTF-8 encoding of one character U+2028. I think this is a valid JSON UTF-8 representation, but since jQuery uses browser's built-in eval() function to parse JSON, this JSON data can't be parsed with Safari and Firefox. You can confirm that by pasting this to your Location bar. javascript:try{eval('({"text":"Foo\u2028Bar"})')} catch(e){alert(e)} This will give...
PREVIOUS POST
【ファミコン名曲】ファミコン元気玉【アレンジメドレー】
【ファミコン名曲】ファミコン元気玉【アレンジメドレー】 Awesome remix of NES game songs.
miyagawa
119
Following
620
Followers
Search
Become a Fan
My Other Accounts
Facebook
|
miyagawa
Twitter
|
miyagawa
Recent Comments
Becky:
Good day and welcome to check: http://www.joyfa...
|
more »
On
One Blog.
Mithaldu:
Yeah, now it works....
|
more »
On
One Blog.
miyagawa:
I believe theres a bug in Feedburner - Tumblr c...
|
more »
On
One Blog.
About
Recent Posts
One Blog.
My new Japanese blog (weblog.bulknews.net)
Read Later apps on Kindle
Kindle Touch
CPAN dependencies are more fun to manage than ever
Kindle Fire Review
Status of cpanmetadb
Carton talk at YAPC::Asia - video
YAPC::Asia 2011 notes
Carton CPAN dependency manager
Archives
November 2011
October 2011
September 2011
August 2011
April 2011
March 2011
February 2011
December 2010
November 2010
October 2010
del.icio.us/miyagawa
Flickr
www.
flick
r
.com
My Last FM
Me on the Web
blog.bulknews.net
Publications List
Flickr: Photos from miyagawa
del.icio.us linklog
miyagawa @ Last.FM
CPAN Modules
bulknews.typepad.com
My Vox blog
Twitter @miyagawa
Tatsuhiko Miyagawa - FriendFeed
Subscribe to this blog's feed
Blog
powered by
Typepad
Recent Comments