Jump to page: 1 2
Thread overview
[Issue 23508] Unable to build japanese named source files
Nov 25, 2022
FeepingCreature
Nov 25, 2022
FeepingCreature
Nov 25, 2022
FeepingCreature
Nov 25, 2022
FeepingCreature
Nov 25, 2022
FeepingCreature
Nov 25, 2022
FeepingCreature
Nov 25, 2022
FeepingCreature
Dec 17, 2022
Iain Buclaw
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

FeepingCreature <default_357-line@yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line@yahoo.de

--- Comment #1 from FeepingCreature <default_357-line@yahoo.de> ---
Works here. Are you sure you've saved app.d as UTF-8?

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #2 from Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> ---
Yes, are you on Windows?

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #3 from FeepingCreature <default_357-line@yahoo.de> ---
Nope, Linux. Maybe there's something weird with how Windows opens text files. But the spec says that the source file has to be (ASCII-7 or) UTF ( https://dlang.org/spec/intro.html#phases-of-compilation ). So if your file is that format, it should be expected to work.

Sorry I can't test on Windows. Maybe that weird encoding is just a DMD output issue, and there's some other reason it can't find the file?

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #4 from Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> ---
This surely is a problem with Windows. I triple checked and both files are using UTF-8 encoding, ( just check on VS Code ). I feel like this problem is related to the file opening API.

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #5 from FeepingCreature <default_357-line@yahoo.de> ---
The relevant code seems to be compiler/src/dmd/common/string.d:122, which converts a D string (UTF-8) to the "system default Windows ANSI code page" (CP_ACP). This then gets passed to GetFileAttributesW to check that the file exists. (file_manager.d:51) Maybe throw a printf in there to see what it does?

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #6 from FeepingCreature <default_357-line@yahoo.de> ---
Hang the hell on. If the symbol name comes from the source, why the fuck does it use the *System ANSI code page* to *convert to UTF-16 from*?!

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #7 from FeepingCreature <default_357-line@yahoo.de> ---
Yeah this is definitely a DMD bug.

Data flow:

Identifier (UTF) ->
getFilename ->
FileManager.lookForSourceFile ->
FileName.exists ->
extendedPathThen ->
toWStringz treats string as default codepage, not UTF ->
GetFileAttributesW (UTF treated as CA_ACP transcoded to UTF-16) ->
error.

To reproduce, would be something like:

- have a Windows computer
- Settings, Region and Language, Administrative, Language for non-Unicode
programs
- Select a language whose encoding is not compatible with UTF-8
- Compile file that imports module with non-ASCII UTF characters.

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

FeepingCreature <default_357-line@yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--
November 25, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

--- Comment #8 from FeepingCreature <default_357-line@yahoo.de> ---
CP_ACP*

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23508

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
« First   ‹ Prev
1 2