microsoft / microsoft/STL

<filesystem>: sometimes path can not work with the string under chinese environment correctly

Open
#469 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug filesystem
Dominant language
C++
Stars
11.2k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Describe the bug
When I invoke std::filesystem::path::generic_string, the VS gets into the debug mode, and it shows that the std::string object can not be converted into wide. I find the std::filesystem::_Check_convert_result return zero at that time. Then I try to use setlocale(LC_ALL, "zh-CN.UTF-8"); to solve the problem. However, this problem occupies again but not the same place, this time it happens when I try to construct a path by the string. It seems that it also can not covert the string correctly.

STL version (git commit or Visual Studio version):latest VS2017

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure in VS2017 using std::filesystem::path::generic_string and path construction from a string under the reported Chinese environment. Inspect the conversion path around std::filesystem::_Check_convert_result and compare behavior with setlocale(LC_ALL, "zh-CN.UTF-8"); done means both reported conversions work without entering the debugger.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.