Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib9: no support for non-ascii chars in path on Windows #3754

Closed
minux opened this issue Jun 18, 2012 · 22 comments
Closed

lib9: no support for non-ascii chars in path on Windows #3754

minux opened this issue Jun 18, 2012 · 22 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@minux
Copy link
Member

minux commented Jun 18, 2012

multibyte characters in Windows path is not encoded in utf8, but all our command
line programs implicitly assume utf8 encoding of path by using lib9/fmt
(even smprint("%s", path) can't correctly handle multibyte paths).

the worst case is: if your user name contains multibyte characters, then you won't be
able to use cmd/go at all, because your os.TempDir() contains multibyte characters;
and you don't have any easy workarounds (os.TempDir() uses syscall.GetTempPath,
and you can't override result of GetTempPath easily). Could we make os.TempDir()
look for %TEMP% or %TMP% first before calling GetTempPath() so that the user at least
could change the temporary directory to workaround the aforementioned problem?
@rsc
Copy link
Contributor

rsc commented Jun 19, 2012

Comment 1:

All strings being obtained from the operating system should be
converted to UTF-8 during those system or library calls. It is easy to
believe we are failing to do that in certain places.
Russ

@alexbrainman
Copy link
Member

Comment 2:

Each Windows api have 2 version: ansi and utf16. We always use utf16 versions. Then we
convert from utf16 into utf8 and back. If some api calls do not follow that path, we
should change them.
@minix: I do not know how your "multibyte characters" fit into ansi/utf16 world.
Perhaps, you should tell us more about the problem you are having.
Alex

@minux
Copy link
Member Author

minux commented Jun 19, 2012

Comment 3:

re #3, sorry, i don't mean go side, i mean the C side (gc, ld, etc);
they incorrectly assume paths will be coded in utf8, but in fact,
file paths might contain multibyte characters (for example, gbk
encoding of chinese characters), esp. if the path come from program
argument.
in other words, our C based commands directly use msvcrt provided
_open(2) function, which uses the ansi version of the underlying
win32 api.

@alexbrainman
Copy link
Member

Comment 4:

I could believe that. I suppose, we should be able to replace these with direct windows
apis of utf16 version. Just like we do for Go.
How did you encountered this problem? What our test case would be?
Alex

@minux
Copy link
Member Author

minux commented Jun 19, 2012

Comment 5:

if you can create a directory with non-ASCII characters (e.g. with character code >
0x80), say A,
put some.go in it, and then go tool 8g A/some.go will fail because 8g can't create
A/some.8.
it's not strictly multibyte character that is troublesome, any character with code >
0x80 and
not utf-8 encoded in a path will cause the problem.

@alexbrainman
Copy link
Member

Comment 6:

It is certainly a problem. But I am not sure how big this problem is. I suspect, Go is
not the only one that breaks in these situations. I propose we wait for people to
complain before we venture into fixing this.
Alex

@minux
Copy link
Member Author

minux commented Jun 21, 2012

Comment 7:

there are certainly people complaining this (I didn't discover this issue myself).
as I mentioned in original report, when your user name contains non-ascii
characters, cmd/go won't work at all (because $WORK will contain non-ascii
characters)
for example, this thread reports this bug in 'go test' (in Chinese):
https://groups.google.com/group/golang-china/browse_thread/thread/84059760815f527a

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 8:

Labels changed: added priority-later, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 9:

Labels changed: added go1.1maybe.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 10:

Labels changed: added size-m.

@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 11:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 12:

Labels changed: added go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 13:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 16, 2013

Comment 14:

Low priority. Deferring to Go 1.3.

Labels changed: added go1.3maybe, removed go1.2maybe.

@robpike
Copy link
Contributor

robpike commented Aug 20, 2013

Comment 15:

Labels changed: removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 16:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 17:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 18:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 19:

Labels changed: added repo-main.

@alexbrainman
Copy link
Member

Comment 20:

Issue #7327 has been merged into this issue.

@ianlancetaylor
Copy link
Contributor

Comment 21:

Labels changed: added suggested, removed priority-later.

@minux minux added accepted Suggested Issues that may be good for new contributors looking for work to do. labels Apr 2, 2014
@minux minux added this to the Go1.5 milestone Mar 30, 2015
@minux
Copy link
Member Author

minux commented Mar 30, 2015

Fixed by the transition of toolchain components to Go in Go 1.5.

@minux minux closed this as completed Mar 30, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

6 participants