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

Solve filename and command line encoding issues on Windows #2449

Merged
merged 12 commits into from
Aug 5, 2021

Conversation

furszy
Copy link

@furszy furszy commented Jun 24, 2021

As the software is currently using the ANSI encoding on Windows, the user's language settings could affect the proper functioning of the node/wallet, to the point of not be able to open some non-ASCII name files and directories.

This solves the Windows encoding issues, completing the entire bitcoin#13869 work path (and some other required backports). Enabling for example users that use non-english characters in directories and file names to be accepted.

Backported PRs:

This is built on top of other two PRs that i have open #2423 and #2369.
Solves old issues #940 and #2163.

TODO:

@furszy furszy self-assigned this Jun 24, 2021
@furszy furszy added this to the 6.0.0 milestone Jun 24, 2021
@furszy furszy added the Windows Issues/problems specifically related to Windows label Jun 24, 2021
@furszy furszy changed the title Solve filename and command line encoding issues on Windows [WIP] Solve filename and command line encoding issues on Windows Jun 24, 2021
@furszy furszy force-pushed the 2021_windows_encoding_issue branch from d6bd0e6 to fb61f4c Compare June 24, 2021 18:57
@furszy furszy force-pushed the 2021_windows_encoding_issue branch from fb61f4c to fa6885d Compare July 24, 2021 02:36
@furszy furszy force-pushed the 2021_windows_encoding_issue branch from fa6885d to 7e09289 Compare July 28, 2021 00:45
@furszy
Copy link
Author

furszy commented Jul 28, 2021

rebased on top of #2489. GA passing now ☕.

random-zebra added a commit that referenced this pull request Aug 1, 2021
84768b5 scripted-diff: bitcoind-->pivxd in tests (random-zebra)
38dae98 qa: Match full plain text by default (MarcoFalke)
92977e5 [Tests] Fix invalid escapes in regex strings to fix W605 (random-zebra)
b6d69ea qa: Allow for partial_match when checking init error (MarcoFalke)
0318a5b [Trivial] Remove extra newline in missing-blocksdir error (random-zebra)
496787a [Tests] Require exact match in assert_start_raises_init_eror() (John Newbery)
6617a99 [Tests] Move assert_start_raises_init_error method to TestNode (random-zebra)

Pull request description:

  Backports
  - bitcoin#12718

  This completes the todo left for
  - #2449.

ACKs for top commit:
  furszy:
    no other changes aside from the typo, utACK 84768b5
  Fuzzbawls:
    ACK 84768b5

Tree-SHA512: 50d527c965bcaf9f07c690cbbeac6c650e88055b1ac4a6f7920e11f3e0f480a8b059e5bd5b4023d7bcc5f1638677aac3c7faf243631d63ce94dca6ad2dd60797
murrayn and others added 12 commits August 1, 2021 11:55
boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows.
This commit add a new class to handle those specific file for Windows.
The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it
Adaptation of btc@a554cc901a32f41162089d6b20ad39d5aeff0583.
Todo: Improve logprint-scanner instead of doing this..
@furszy furszy force-pushed the 2021_windows_encoding_issue branch from 7e09289 to 63e0be6 Compare August 1, 2021 14:58
@furszy furszy changed the title [WIP] Solve filename and command line encoding issues on Windows Solve filename and command line encoding issues on Windows Aug 1, 2021
@furszy
Copy link
Author

furszy commented Aug 1, 2021

rebased after 2489 merge.

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 63e0be6

This is, as far as I could test, feature-complete for supporting non-english (but UTF8) characters in filenames and command line arguments. haven't tested native UTF8 non-english locales in windows yet.

The last nail in this coffin is windows unicode character support, which is included here for directory and file names in general, but LevelDB needs an update to include such support, which I have added in #2495.

@random-zebra
Copy link

Gitian build (Merge 63e0be6 into 807b044):

Generating report
c3923b666b3a6dd4ce98b93ff383c58b3f1df119c6d51a1b9e418a815623397b  pivx-5.2.99-win-unsigned.tar.gz
81aabe1476cfebbd150e71925e5a1dd7801b50314a46c554c15f981d07a4b45f  pivx-5.2.99-win64-debug.zip
e64573102e1dac138206e6a73e083e34163d7472ab0241850f07cf89639b9709  pivx-5.2.99-win64-setup-unsigned.exe
92ee7674e24a69f45ace02855ce4d01af0bef26be0bb8d8bde0d29b96e625dfc  pivx-5.2.99-win64.zip
a6fcf669a583c1458cd3916f80a62746e82c81abf53972c12775ee9dd7ac2a8e  src/pivx-5.2.99.tar.gz
87871f4da530e35d30b4cde1944e894f83472132c2ae8a8b6b07b371d5e77fa3  pivx-win-5.2-res.yml

Tested fresh install on Windows10 with japanese locales.
The NSIS installer failed.
Also, as pointed out above by Fuzz, LevelDB needs an update.
Currently using a non-ASCII char in the datadir, or, for example, in the username, still results in a crash:

2021-08-05T11:13:32Z Opening LevelDB in C:\Users\聡\AppData\Roaming\PIVX\blocks\index
2021-08-05T11:13:32Z NotFound: C:\Users\聡\AppData\Roaming\PIVX\blocks\index/LOCK: ????????????????

2021-08-05T11:13:32Z Database entry missing
2021-08-05T11:13:34Z Wiping LevelDB in C:\Users\聡\AppData\Roaming\PIVX\blocks\index
2021-08-05T11:13:34Z Opening LevelDB in C:\Users\聡\AppData\Roaming\PIVX\blocks\index
2021-08-05T11:13:34Z NotFound: C:\Users\聡\AppData\Roaming\PIVX\blocks\index/LOCK: ????????????????

BUT using the same non-ASCII char for other things, e.g. the wallets dir, works fine now:
Screenshot from 2021-08-05 13-30-44

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 63e0be6 and merging...

@random-zebra random-zebra merged commit 61a098a into PIVX-Project:master Aug 5, 2021
furszy added a commit that referenced this pull request Aug 5, 2021
b7603ca Squashed 'src/leveldb/' changes from 0c40829872..f8ae182c1e (Fuzzbawls)

Pull request description:

  Companion to #2449 that includes Unicode character support in the LevelDB side of things for windows.

ACKs for top commit:
  random-zebra:
    ACK 59ffc7b
  furszy:
    utACK 59ffc7b and merging..

Tree-SHA512: f0a85b6cb90522eb9cb845e413dcf66c15c6e970d0c9c853873383ee16430f35e93bd2d045cebda9f3daa7e859e33358becf1c86f2786c8099812756576f801d
@furszy furszy deleted the 2021_windows_encoding_issue branch June 23, 2023 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Issues/problems specifically related to Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants