November 2, 20223 yr I sent the following sentence through Google Translation API (english -> french) and the response substituted certain characters for HTML (I think). I played around with DECODE options to return the code to the actual characters I need, but haven't yet found the solution. Sent: the woman yelled at the man Received: la femme a crié à l'homme Full response: { "data": { "translations": [ { "translatedText": "la femme a crié à l'homme" } ] } } Thanks
November 2, 20223 yr That's not proper JSON: for one thing, there is no need to escape an apostrophe in JSON; for another, if you really wanted to escape it, you would use the form \u0027, not '. I find it hard to believe that Google would get this wrong (and that you would be the first one to notice) - so I googled (ha!) for 'google translate api escape apostrophe' and found this as the 1st result: https://stackoverflow.com/a/63272510/17153010: 2 hours ago, Jeffrey Bloch said: I played around with DECODE options Not sure what you're referring to.
November 2, 20223 yr Author 1 hour ago, comment said: That's not proper JSON: for one thing, there is no need to escape an apostrophe in JSON; for another, if you really wanted to escape it, you would use the form \u0027, not '. I find it hard to believe that Google would get this wrong (and that you would be the first one to notice) - so I googled (ha!) for 'google translate api escape apostrophe' and found this as the 1st result: https://stackoverflow.com/a/63272510/17153010: Not sure what you're referring to. I'll check out the article. Thanks. 1 hour ago, comment said: That's not proper JSON: for one thing, there is no need to escape an apostrophe in JSON; for another, if you really wanted to escape it, you would use the form \u0027, not '. I find it hard to believe that Google would get this wrong (and that you would be the first one to notice) - so I googled (ha!) for 'google translate api escape apostrophe' and found this as the 1st result: https://stackoverflow.com/a/63272510/17153010: Not sure what you're referring to. format=text did the trick. Thanks! Edited November 2, 20223 yr by Jeffrey Bloch
Create an account or sign in to comment