Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1063)

Issue 551580045: Fix MinGW UTF-8 locale settings

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years ago by trueroad
Modified:
4 years ago
Reviewers:
Be-3
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Issue 5833/3: Doc: Add handling Unicode filenames on Windows to changes Issue 5833/2: Add workaround for MinGW UTF-8 stat issue When UTF-8 process locale is active, LilyPond could not find some Unicode filenames. `stat ()` in msvcrt.dll returns `-1` (i.e. error) with some UTF-8 filenames even if process code page is UTF-8 and the file exists. So we get the process code page with `GetACP ()` and, if it is UTF-8, convert the filename to wide strings and use `_wstat ()`. If Universal CRT (UCRT, newer than msvcrt.dll) is used (i.e. `_UCRT` is defined), no such workaround is needed. Issue 5833/1: Add workaround for MinGW UTF-8 locale settings issue Issue 2173 and 5828 activates UTF-8 process locale on Windows. They allow LilyPond for Windows to use Unicode filenames. However, when LilyPond outputs Unicode strings to tty, it garbled. `setlocale (LC_ALL, "")` in msvcrt.dll sets user-defined ANSI code page (i.e. 437 for English, 932 for Japanse, etc.) even if process code page is UTF-8 (i.e. 65001 for all languages). With this setting, outputting UTF-8 string becomes garbled. So we get the process code page with `GetACP ()` and, if it is UTF-8, explicitly set locale's code page to UTF-8 (i.e. 65001). If Universal CRT (UCRT, newer than msvcrt.dll) is used (i.e. `_UCRT' is defined), no such workaround is needed.

Patch Set 1 #

Patch Set 2 : more workaround #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -4 lines) Patch
M Documentation/changes.tely View 1 1 chunk +5 lines, -0 lines 0 comments Download
M flower/file-path.cc View 1 3 chunks +49 lines, -4 lines 0 comments Download
M lily/main.cc View 1 2 chunks +19 lines, -0 lines 0 comments Download

Messages

Total messages: 3
Be-3
LGTM. Arigato!
4 years ago (2020-03-08 11:38:12 UTC) #1
trueroad
more workaround
4 years ago (2020-03-10 10:50:08 UTC) #2
trueroad
4 years ago (2020-03-15 12:56:36 UTC) #3
I've pushed to staging.

commit f38a526a97ec3659dd450d9f4fbc15caa30216ec
Issue 5833/3: Doc: Add handling Unicode filenames on Windows to changes

commit c453b26d6eae33a537aeabd68501c00a6bf3bf5f
Issue 5833/2: Add workaround for MinGW UTF-8 stat issue

commit 6b34654ae7f93b9228e860c130754f83a6c35d21
Issue 5833/1: Add workaround for MinGW UTF-8 locale settings issue
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b