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

unicode character in vcxproj.filters might get trouble #136

Open
Wongboo opened this issue Nov 14, 2021 · 13 comments · May be fixed by #138
Open

unicode character in vcxproj.filters might get trouble #136

Wongboo opened this issue Nov 14, 2021 · 13 comments · May be fixed by #138

Comments

@Wongboo
Copy link

Wongboo commented Nov 14, 2021

If we have such lines with unicode in vcxproj.filters

<Filter Include="中文Πhappy">
...
<Filter Include="help">
...
<Filter Include="한국어">
...
<Filter Include="にほんご">
...

they will eventually become

source_group("help" FILES ${help})
source_group("中文Πhappy" FILES ${happy})
source_group("한국어" FILES ${})
source_group("にほんご" FILES ${})

As you can see, because cmakeconverter ignore all unicode character, the filter with only unicode character will become variable with no name, eventually cause trouble, such as 한국어, we can fix in two ways:

  • force a name for string with all unicode character
  • looks like cmake support variable for unicode name, see note, maybe need more test
@Wongboo
Copy link
Author

Wongboo commented Nov 14, 2021

looks like cmake doesn't support variable with unicode name like 한국어, instead of generating ${}, maybe generating ${other char} is better?

@pavelliavonau
Copy link
Owner

Better rename your symbols to latin words that cmake supports

@Wongboo
Copy link
Author

Wongboo commented Nov 15, 2021

For existing project with loads of unicode variable, It might be hard to change, how about:
CMakesLists.txt

source_group("help" FILES ${help})
source_group("中文Πhappy" FILES ${unicode_var1}) # unicode_var1 means 中文Πhappy
source_group("한국어" FILES ${unicode_var2}) # unicode_var2 means 한국어
source_group("にほんご" FILES ${unicode_var3}) # unicode_var1 means にほんご

stdout

info/warning: detect unicode variable "にほんご", rename to unicode_var3

@pavelliavonau
Copy link
Owner

I don't like Idea of generating names. Considered this from the very beginning.
I shall not implement a thing that CMake does not support. You may help CMake to implement it first if you want.
I fixed this problem with 33d7559. You should get warning like check conversion "{}" -> "{}"

Have you checked all the warnings before creating this issue?

And renaming is not hard. Just open UI and rename all non latin filters. It's prepearing step for conversion. Then you may convert easily.

@Wongboo Wongboo closed this as completed Nov 16, 2021
@Wongboo Wongboo reopened this Nov 16, 2021
@Wongboo
Copy link
Author

Wongboo commented Nov 16, 2021

I find that I may need to reopen this issue, because visual studio under certain default language will generate unicode character forever as they are default choose, the words in English are Source Files, Header Files, Resource Files

@Wongboo
Copy link
Author

Wongboo commented Nov 16, 2021

Language word1 word2 word3
English Source Files Header Files Resource Files
Chinese(Simplified) 源文件 头文件 资源文件
Chinese(Traditional) 原始程式檔 標頭檔 資源檔
Japanese ソースファイル ヘッダーファイル リソースファイル
Korean 원본 파일 헤더 파일 리소스 파일

@Wongboo
Copy link
Author

Wongboo commented Nov 16, 2021

Maybe a map for these words are necessary

@pavelliavonau
Copy link
Owner

What are you proposing? Translate with cmake-converter?

  1. cmake DOES NOT SUPPORT these symbols.
  2. 4 languages that you've mentioned are not all the unicode languages that might be used. I'm not going to support every translation.
  3. cmake-converter is not a translator. I'm not going to support this anyway. I actually CAN'T SUPPORT this because I don't know these languages.

If you need to convert you may create your own tool that replace unicode at your files with generated latin ones. Convert. Then replace back at CMakeLists.txt to that format that you would like.

@Wongboo
Copy link
Author

Wongboo commented Nov 16, 2021

No, visual studio seems only generate these 3 unicode words for each language(all in my table), just map them to English can fix the problem, no need to translate every unicode word

@Wongboo
Copy link
Author

Wongboo commented Nov 16, 2021

If user use some unicode words, they should fix themselves. But for the words generated by visual studio default setting for these language mode, map them to English, because you can't assume everyone use VS in English mode

@Wongboo
Copy link
Author

Wongboo commented Nov 16, 2021

Source Files, Header Files, Resource Files are predefined logical folders (filters) in vcproj.filter. If you don't use VS in English, VS will translate Source Files, Header Files, Resource Files, for some language like French, it doesn't matter, for some, it does.
No need to translate every word, just these three predefined logical filters

Wongboo added a commit to Wongboo/cmakeconverter that referenced this issue Nov 16, 2021
@Wongboo Wongboo linked a pull request Nov 16, 2021 that will close this issue
@pavelliavonau
Copy link
Owner

Again.
I do not want to check in any translator into cmake-converter codebase.
I do not want to implement any "hacky and partial solution". This is partial solution at least because you cannot guarantee that you have the full list of predefined values. Also this is partial solution because it does not cover all languages that have unicode symbols.
Since it's partial - I won't implement and support this.

But nice try for hack this for asian users.

@Wongboo
Copy link
Author

Wongboo commented Nov 17, 2021

People can complete this dictionary later on, this need more people's help. This partial dictionary won't even slow down for English users, will bring help to asian language users and actually give a template for other language, This is a partial fix, but the only downside is that it slow down a bit for unicode users, I don't see why don't use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants