How to decode \u0026quot;

1,673 views
Skip to first unread message

Max Gulevich

unread,
Aug 14, 2009, 11:46:13 AM8/14/09
to Google AJAX APIs
Hello all!
I use Google Translate and got the following problem:

When I try to translate a phrase with (for example) quotes it causes
the following:

Request:
http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=click%20%22send%22%20button&langpair=|de

Response:
{"responseData": {"translatedText":"Klicken Sie auf \u0026quot;Senden
\u0026quot;-Button","detectedSourceLanguage":"en"}, "responseDetails":
null, "responseStatus": 200}

How to convert \u0026quot; into a quote? I believe that there are huge
amount of characters which could be encoded like a quote (<, >, etc).
How to display the translated text on HTML page?

I use .Net framework 2.0 and as you maybe understand not an
experienced developer :)

Any help would be appreciated.

Thanks,
Max

Jeff S (Google)

unread,
Aug 14, 2009, 9:29:06 PM8/14/09
to Google-AJAX...@googlegroups.com
Hi Max,

It sounds like you'll need something that will do HTML un-escaping for you. As it sounds like you've figured out, I think the \u0026quot; string likely represents the " character. For the benefit of others reading along, in HTML, the " is represented by &quot; and at some point it looks like the & is being converted to it's unicode equivalent \u0026 . The list of HTML escape characters is a bit long, and you can actually represent any unicode character using a pattern like this:

&#106;

Which is the letter j.

Some searching on the web turned up the following, which might be a viable option

http://msdn.microsoft.com/en-us/library/7c5fyk1k(VS.80).aspx

I haven't tried it myself though.

Thank you,

Jeff
Reply all
Reply to author
Forward
0 new messages