Gideon
Gideon

Reputation: 1547

Diacritic Letters are mistreated by Rest Client

I'm using rest:0.8 to connect my main Grails project to another Grails project that serves as a report generator using this line of code:

Map<String, String> adminConfigService = [
    webURL: "http://192.168.20.21:8080/oracle-report-service/generate",
    ...
]

Map params = [
    ...
    name: "Iñigo",
    ...
]

withHttp(uri: adminConfigService.webURL) {
    html = get(query: params)
}

And then the receiving REST client will process that data. Running the two projects in my local machine works fine. Although when I deploy the war file of the report generator to our tomcat server, it converts the letter "ñ" to "├â┬æ", so the name "Iñigo" is treated as "I├â┬æigo".

Since the Report Generator project works fine when run on my local machine, does that means I need to change some conf files on my Tomcat Server? What setting file do I need to change?

Upvotes: 0

Views: 72

Answers (1)

Vladimir
Vladimir

Reputation: 507

It seems like encoding issue.

  1. Check Config.groovy:

grails.converters.encoding = "UTF-8"

  1. Check file's encoding of controllers and services where you use rest:0.8.
  2. Check URIEncoding in tomcat's server.xml (must be UTF-8). Also try to set useBodyEncodingForURI="true" (in connector, like URIEncoding parameter).
  3. Do you save this data to the database? If that so, check your DataSource.groovy url parameter:

url = "jdbc:mysql://127.0.0.1:3306/dbname?characterEncoding=utf8"

Also check encoding and collation of you table and fields in the database.

Upvotes: 1

Related Questions