How to control the string encoding UTF


When compiling to javaScript the dart2js compiler converts the string to an escaped utf format


I am not sure why his is done (the original file contains text strings that are in cyrillic, but the system (and hopefully DartEditor) use UTF).

Other compilers (like Closure or TypeScript) leave it as it is.

I am wondering if someone can explain:

  1. Why it is done in this way
  2. What is the significance of this
  3. Is there a way to turn this off



When dart2js reads a string it decodes that string. For example if your string contained a \n it decodes it into a new line character. When dart2js writes the string out, it does needs to encode the strings again. For simplicity dart2js simply encodes everything that is not ASCII.

Please file a bug report, and we will have a look to see if it’s easy to fix.

Answered By – Florian Loitsch

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *