Jeffrey Bloch Posted November 2, 2022 Posted November 2, 2022 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
comment Posted November 2, 2022 Posted November 2, 2022 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.
Jeffrey Bloch Posted November 2, 2022 Author Posted November 2, 2022 (edited) 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, 2022 by Jeffrey Bloch
Recommended Posts
This topic is 821 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now