问题描述
我在C#中有一个带有Unicode字符(韩文字符)的字符串.
该字符串应先通过C ++,然后再传递给Java.
在C#中输入字符串会
数据源= | DataDirectory |안녕하세요.sdf
当这样传递Unicode字符串时,我得到的是?"在Java方面.我尝试使用 Server.UrlEncode(InputString)
结果字符串是
数据+源%3d%7cDataDirectory%7c%ec%95%88%eb%85%95%ed%95%98%ec%84%b8%ec%9a%94.sdf
我的字符串被转换为%编码的UTF-8字符(如果我没记错的话).该字符串将传递给C ++,最后传递给Java.
在Java端,当我显示给User时,我在那里使用URLDecoder函数,然后又得到了朝鲜语字符.
我的问题是..这是一种处理Unicode字符的有效且正确的方法吗?还是有其他最简单的方法来解决这个问题??
更新:
我的字符串也可以有点小..其中有超过1000个字符.
I have a string with unicode characters in it (Korean characters) in C#.
That string should pass through C++ and then to Java.
Input String in C# wil be
Data Source=|DataDirectory|안녕하세요.sdf
When Unicode string gets passed as such i am getting '?' in the Java side. I tried to use Server.UrlEncode(InputString)
The resultant string is
Data+Source%3d%7cDataDirectory%7c%ec%95%88%eb%85%95%ed%95%98%ec%84%b8%ec%9a%94.sdf
My String gets converted to % encoded UTF-8 characters(if i m not wrong). This string will get passed to C++ and then finally to Java.
In Java side when i display in to the User i use URLDecoder function there and I get the Korean characters back..!
My question is.. Is this a efficient and correct approach to deal with Unicode Characters.? Or is there any other simplest way to handle this.?
Update:
My string can also be little big one.. with more than 1000 characters in it. Will URLEncode and Decode work under processing Huge strings tooo?
这篇关于使用URLEncoding转换Unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!