New issue
Advanced search Search tips
Starred by 9 users
Status: New
Owner: ----



Sign in to add a comment
Allow latin-1 character encoding in user directory
Reported by joao...@gmail.com, Dec 12 2013 Back to list
What steps will reproduce the problem?
1. using node-gyp on any system where the user name has latin-1 characters
2.
3.

What is the expected output? What do you see instead?
to generate the .vcxproj in UTF-8 encoding (currently is in ASCII)


What version of the product are you using? On what operating system?
0.12.1 on Windows 8.1

Please provide any additional information below.
WriteXmlIfChanged on pylib/gyp/easy_xml.py actually output to ascii encoding. Converting directly to utf-8 fails, so unidecode needs to be used first.

This path was a very quick fix that works for me, but more work needs to be done, like detecting the native enconding ro something like that. In may case it was latin-1, but it might be others.

 
Comment 1 by joao...@gmail.com, Dec 12 2013
Sorry it was unicode not unidecode
Comment 2 by joao...@gmail.com, Jun 28 2014
This simple patch solves the problem when building on windows with usernames with non-ascii letters.

On the file  pylib/gyp/easy_xml.py

Simply find this pieace of code

  # It has changed, write it
  if existing != xml_string:
    f = open(path, 'w')
    f.write(xml_string)
    f.close()

and change to something like this:

  # It has changed, write it
  if existing != xml_string:
    f = open(path, 'w')
    try:
      xml_string = xml_string.encode(encoding)
    except Exception:
      xml_string = unicode(xml_string, 'latin-1').encode(encoding)
    f.write(xml_string)
    f.close()

Sign in to add a comment