cjk

Write Chinese chars to a text file using vbscript

徘徊边缘 提交于 2019-12-20 02:11:15
问题 I'm trying to write some Chinese characters to a text file using Set myFSO = CreateObject("Scripting.FileSystemObject") Set outputFile = myFSO.OpenTextFile(getOutputName(Argument, getMsiFileName(Wscript.Arguments)), forWriting, True) outputFile.WriteLine(s) The variable s contains a Chinese character that I read from the other file. I echo s value and I can see the s correctly in the screen. However, for some reason the script stops running after outputFile.WriteLine(s) without returning any

Any libraries to convert number Pinyin to Pinyin with tone markings?

百般思念 提交于 2019-12-19 09:54:07
问题 Just wondering if anyone knows of a class library that can convert Chinese Pinyin to ones with tones, such as nin2 hao3 ma to nín hǎo ma. It would be similar to this answer, but hopefully using the .NET framework. 回答1: Here is my porting of @Greg-Hewgill python algorithm to C#. I haven't run into any issues so far. public static string ConvertNumericalPinYinToAccented(string input) { Dictionary<int, string> PinyinToneMark = new Dictionary<int, string> { {0, "aoeiuv\u00fc"}, {1, "\u0101\u014d

Any libraries to convert number Pinyin to Pinyin with tone markings?

ぃ、小莉子 提交于 2019-12-19 09:52:54
问题 Just wondering if anyone knows of a class library that can convert Chinese Pinyin to ones with tones, such as nin2 hao3 ma to nín hǎo ma. It would be similar to this answer, but hopefully using the .NET framework. 回答1: Here is my porting of @Greg-Hewgill python algorithm to C#. I haven't run into any issues so far. public static string ConvertNumericalPinYinToAccented(string input) { Dictionary<int, string> PinyinToneMark = new Dictionary<int, string> { {0, "aoeiuv\u00fc"}, {1, "\u0101\u014d

Regex for Matching Pinyin

陌路散爱 提交于 2019-12-19 06:55:13
问题 I'm looking for a regular expression that can correctly match valid pinyin (e.g. "sheng", "sou" (while ignoring invalid pinyin, e.g. "shong", "sei"). Most of the regex provided in the top Google results match invalid pinyin in some cases. Obviously, no matter what approach one takes, this will be a monster regex, and I'm especially interested in the different approaches one could take to solve this problem. For example, "Optimizing a regular expression to parse chinese pinyin" uses lookbacks.

Regex for Matching Pinyin

爱⌒轻易说出口 提交于 2019-12-19 06:54:35
问题 I'm looking for a regular expression that can correctly match valid pinyin (e.g. "sheng", "sou" (while ignoring invalid pinyin, e.g. "shong", "sei"). Most of the regex provided in the top Google results match invalid pinyin in some cases. Obviously, no matter what approach one takes, this will be a monster regex, and I'm especially interested in the different approaches one could take to solve this problem. For example, "Optimizing a regular expression to parse chinese pinyin" uses lookbacks.

Split a sentence into separate words

孤街浪徒 提交于 2019-12-18 10:55:19
问题 I need to split a Chinese sentence into separate words. The problem with Chinese is that there are no spaces. For example, the sentence may look like: 主楼怎么走 (with spaces it would be: 主楼 怎么 走 ). At the moment I can think of one solution. I have a dictionary with Chinese words (in a database). The script will: try to find the first two characters of the sentence in the database ( 主楼 ), if 主楼 is actually a word and it's in the database the script will try to find first three characters ( 主楼怎 ).

How to use Boost Spirit to parse Chinese(unicode utf-16)?

让人想犯罪 __ 提交于 2019-12-18 06:59:08
问题 My program does not recognize Chinese. How to use spirit to recognize Chinese? I use wstring and has convert it to utf-16. Here is my header file: #pragma once #define BOOST_SPIRIT_UNICODE #include <boost/spirit/include/qi.hpp> #include <string> #include <vector> #include <map> using namespace std; namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; typedef pair<wstring,wstring> WordMeaningType; typedef vector<WordMeaningType> WordMeaningsType; typedef pair<wstring

Flutter fetched Japanese character from server decoded wrong

半城伤御伤魂 提交于 2019-12-18 05:45:06
问题 I am building a mobile app with Flutter. I need to fetch a json file from server which includes Japanese text. A part of the returned json is: { "id": "egsPu39L5bLhx3m21t1n", "userId": "MCetEAeZviyYn5IMYjnp", "userName": "巽 裕亮", "content": "フルマラソン完走に対して2018/05/06のふりかえりを行いました!" } Trying the same request on postman or chrome gives the expected result (Japanese characters are rendered properly in the output). But when the data is fetched with Dart by the following code snippet: import 'dart

Detect chinese (multibyte) character in the string

≡放荡痞女 提交于 2019-12-18 01:08:16
问题 $str = "This is a string containing 中文 characters. Some more characters - 中华人民共和国 "; How do I detect chinese characters from this string and print the part which starts with the first character and ends with "-"? (it would be "中文 characters. Some more characters -"). Thank you! 回答1: I've solved this problem using preg_match and regular expressions: $str = "This is a string containing 中文 characters. Some more characters - 中华人民共和国 "; preg_match(/[\x{4e00}-\x{9fa5}]+.*\-/u, $str, $matches); 回答2:

How to save Chinese Characters to file with java?

瘦欲@ 提交于 2019-12-17 22:24:42
问题 I use the following code to save Chinese characters into a .txt file, but when I opened it with Wordpad, I couldn't read it. StringBuffer Shanghai_StrBuf = new StringBuffer("\u4E0A\u6D77"); boolean Append = true; FileOutputStream fos; fos = new FileOutputStream(FileName, Append); for (int i = 0;i < Shanghai_StrBuf.length(); i++) { fos.write(Shanghai_StrBuf.charAt(i)); } fos.close(); What can I do ? I know if I cut and paste Chinese characters into Wordpad, I can save it into a .txt file. How