Jump to content
Server Maintenance This Week. ×

GOOGLE TRANSLATION API (coding)


This topic is 548 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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 by Jeffrey Bloch
Link to comment
Share on other sites

This topic is 548 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.