Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[text-to-speech] Customization getWords() returning escaped Unicode characters #532

Closed
jeffpk62 opened this issue Jan 22, 2017 · 1 comment
Assignees

Comments

@jeffpk62
Copy link
Contributor

The TTS customization getWords() method is returning escaped Unicode characters for < and >. These characters are returned correctly with the HTTP REST and Node.js interfaces. For example, the following CustomTranslation objects are added to a model with the saveWords() method:

    CustomTranslation translation3 = new CustomTranslation("EEE", "<phoneme alphabet=\"ibm\" ph=\"tr1Ipxl.1i\"></phoneme>");
    CustomTranslation translation4 = new CustomTranslation("IEEE", "<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>");

The output of getWords() looks like the following:

[{
  "word": "ACLs",
  "translation": "ackles"
}, {
  "word": "EEE",
  "translation": "\u003cphoneme alphabet\u003d\"ibm\" ph\u003d\"tr1Ipxl.1i\"\u003e\u003c/phoneme\u003e"
}, {
  "word": "IEEE",
  "translation": "\u003cphoneme alphabet\u003d\"ibm\" ph\u003d\"1Y.tr1Ipxl.1i\"\u003e\u003c/phoneme\u003e"
}, {
  "word": "NCAA",
  "translation": "N C double A"
}, {
  "word": "iPhone",
  "translation": "I phone"
}]

It should look like this:

  "words": [
    {
      "translation": "ackles",
      "word": "ACLs"
    },
    {
      "translation": "<phoneme alphabet=\"ibm\" ph=\"tr1Ipxl.1i\"></phoneme>",
      "word": "EEE"
    },
    {
      "translation": "<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>",
      "word": "IEEE"
    },
    {
      "translation": "N C double A",
      "word": "NCAA"
    },
    {
      "translation": "I phone",
      "word": "iPhone"
    }
  ]
@germanattanasio
Copy link
Contributor

The value has < and > but it was escaped by Gson when calling the toString().
See: http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/GsonBuilder.html#disableHtmlEscaping%28%29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants