cmakeconverter icon indicating copy to clipboard operation
cmakeconverter copied to clipboard

unicode character in vcxproj.filters might get trouble

Open Wongboo opened this issue 2 years ago • 13 comments

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 avatar Nov 14 '21 02:11 Wongboo

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

Wongboo avatar Nov 14 '21 03:11 Wongboo

Better rename your symbols to latin words that cmake supports

pavelliavonau avatar Nov 14 '21 15:11 pavelliavonau

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

Wongboo avatar Nov 15 '21 01:11 Wongboo

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 33d75594660e746bdec. 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.

pavelliavonau avatar Nov 15 '21 13:11 pavelliavonau

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 avatar Nov 16 '21 00:11 Wongboo

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

Wongboo avatar Nov 16 '21 00:11 Wongboo

Maybe a map for these words are necessary

Wongboo avatar Nov 16 '21 00:11 Wongboo

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.

pavelliavonau avatar Nov 16 '21 12:11 pavelliavonau

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 avatar Nov 16 '21 12:11 Wongboo

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 avatar Nov 16 '21 12:11 Wongboo

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 avatar Nov 16 '21 12:11 Wongboo

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.

pavelliavonau avatar Nov 16 '21 16:11 pavelliavonau

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.

Wongboo avatar Nov 17 '21 00:11 Wongboo