Skip to content

Commit

Permalink
gyp: fix for non-acsii userprofile name on Windows
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 9f3a1b2
Author: João Henriques <joaoh88@gmail.com>
Date:   Tue Dec 17 21:14:18 2013 +0000

    Update easy_xml.py

    Better handling of encoding

commit a8b4942
Author: João Henriques <joaoh88@gmail.com>
Date:   Thu Dec 12 04:09:38 2013 +0000

    Quick and dirty fix to allow WriteXmlIfChanged to write xml in utf-8, converting latin-1 directory paths.

Closes #366.
Closes #554.
Fixes #297.
Fixes #404.
Fixes #476.
  • Loading branch information
jfhenriques authored and TooTallNate committed May 24, 2015
1 parent 5f4b185 commit 39a06bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gyp/pylib/gyp/easy_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
xml_string = XmlToString(content, encoding, pretty)
if win32 and os.linesep != '\r\n':
xml_string = xml_string.replace('\n', '\r\n')

try:
xml_string = xml_string.encode(encoding)
except Exception:
xml_string = unicode(xml_string, 'latin-1').encode(encoding)

# Get the old content
try:
Expand Down

12 comments on commit 39a06bc

@zonzujiro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working for me.

@TooTallNate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you're using an updated version of node-gyp?

@TooTallNate
Copy link
Contributor

@TooTallNate TooTallNate commented on 39a06bc May 25, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zonzujiro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I checked easy_xml.py and it's allready have this code.

@TooTallNate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the easy_xml.py file located? What command are you running to invoke node-gyp?

@zonzujiro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C:\Users\Иван\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp - location of easy_xml.py

I just trying to install mongoose.

@zonzujiro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node-gyp installed with -g key

@TooTallNate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya see, that's not updating the copy of node-gyp that npm uses. Please read the link https://github.com/TooTallNate/node-gyp/wiki/Updating-npm's-bundled-node-gyp#windows

@zonzujiro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's helped, thank you.

@ar-arkhipov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. I had the same problem, then I installed node-gyp@latest in npm folder.
After that it seemed that there is no problems with non latin symbols anymore, but a new error appeared and I cant do anything with it:

fatal error C1083: Cannot open include file: 'v8.h': No such file or directory

this error is given by different "*.cc" files during installation of some packages.
I have Windows 7 SP1, .Net Framework SDK 4, 4.5, MSVS 2010 and 2013
I tried different flags like --msvs_version=2010, or 2013. Tried to reinstall visual studio and others according strictly to your instructions about node-gyp installation and using, but the result is the same.

Please help me to solve this failings.

@SvetlozarValchev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be made more global, as various countries use different encodings. I had the same error as @Tamango92 and replacing 'latin-1' to 'windows-1251' fixed it. If you are having the same issue it's a good idea to check what your operating system uses as default encoding.

@bnoordhuis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CBeTHaX Can you file an issue for that?

@TooTallNate Was this change upstreamed?

Please sign in to comment.