UnityC# realizes Chinese characters to pinyin - using Microsoft CHSPinYinConv library

Some time ago, I used NPinyin.dll to convert Chinese to pinyin to get the first letter. The recent version iteration found that it can’t be used. Encoding.GetEncoding("gb2312"); After this code, all subsequent statements are not executed. I couldn't find the reason. I thought it was caused by the non-existence of some library files, so I simply didn't deal with it later. I found a Microsoft implementation method to solve this problem, and it is the Zhenxiang series!
Next, start to explain the implementation method: First, download the software ZIP package from the Microsoft official website and get the vsintlpack1.zip compressed package, unzip it and install the following software: CHSPinYinConv.msi.
insert image description here
After installation, find the software installation directory, and get the dll library file we need: chncharinfo.dll
insert image description here
The next step is to import it into Unity, and start our code implementation. .

   //引用命名空间
   using Microsoft

Guess you like

Origin blog.csdn.net/qq_41088607/article/details/125870832
Recommended