Question
Gery Gerena · Feb 22, 2017

Encoding issues with plain text file and server

In my country we speak in spanish. My developing machine uses windows 8.1

I made a nice looking html mock-up using angular material (in Atom, writing in UTF-8). I just moved that mock-up to the CSP folder inside Ensemble and it shows the typical weird characters of character encoding problems.

Have you had an issue like this before?

My temporal solution for the html files: I just configured Atom to read the files in Windows 1252 encoding.


However I still see weird characters on a query to the DB (I made a rest service that returns a json than in turn I use to fill a select input in the html)

 

 

0
0 870
Discussion (6)0
Log in or sign up to continue

For HTML files:

  • Move them to another non-web-app folder
  • Convert them all to utf-8
  • Execute in a terminal: set ^%SYS("CSP","DefaultFileCharset")="utf-8"
  • Move them back

see weird characters on a query to the DB

REST output or input REST params? What locale are you using for server?

Thank you very much Eduard!

The global made it work for the CSP files!

I'm outputting characters from the Rest Service. The locale I'm using is enuw however I tried changing it to espw but it didn't work.

This from System > Configuration > Locale Definitions

Add these lines at the beginning of your REST method if you're on older versions (pre 16.1 I think):

Set %response.CharSet = "utf-8"
Set %response.ContentType="application/json"

If you're on a newer version add class params to your broker class:

Parameter CHARSET = "utf-8";
Parameter CONTENTTYPE = "application/json";

It didn't work. I'm now investigating if the way that AngularJS handles the $http.get has to do with it.

Compare Angular results with REST API debugger, such as Postman and debug proxy, i.e. Charles.

What I finally did was use this form of $zconvert:

 $ZCONVERT(tRS.%Get("description"),"O","UTF8")