需要有关unicode字符串的帮助。 [英] Need help with unicode strings.

查看:64
本文介绍了需要有关unicode字符串的帮助。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件,我想从中读取UTF-16 unicode字符串。

最简单的方法是什么?


谢谢提前,

Nick Z.

I have a file that I want to read a UTF-16 unicode string from.
What is the easiest way to accomplish that?

Thanks in advance,
Nick Z.

推荐答案

Nick Z.< an ******* @ none .COM>写道:
Nick Z. <an*******@none.com> wrote:
我有一个文件,我想从中读取UTF-16 unicode字符串。
最简单的方法是什么?
I have a file that I want to read a UTF-16 unicode string from.
What is the easiest way to accomplish that?




使用带有Encoding.Unicode的StreamReader - 它很轻松。


(我不相信你会发现UCS-2之间有任何区别和UTF-16 - 我

我不知道哪个Encoding.Unicode应该代表,但我是

确定它*实际上*最终工作了作为UTF-16,因为.NET字符串

无论如何都是UTF-16 ......)


-

Jon Skeet - < sk *** @ pobox.com>
http: //www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



Using a StreamReader with Encoding.Unicode - it''s a doddle.

(I don''t believe you''ll see any difference between UCS-2 and UTF-16 - I
don''t know which Encoding.Unicode is supposed to represent, but I''m
sure it *actually* ends up working out as UTF-16, because .NET strings
are UTF-16 in some sense anyway...)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


A StreamReader使用UnicodeEncoding


System.Text.Encoding.UnicodeEncoding)

其中fs是一个文件流


hth,

Alan。

A StreamReader using the UnicodeEncoding

dim reader as new StreamReader(fs,
System.Text.Encoding.UnicodeEncoding)

where fs is a filestream

hth,
Alan.


谢谢,

我无法相信我忽略了这一点。

我之前甚至玩过编码枚举而且因为某些原因它没有用于我/ b $ b我工作现在......


感谢您抽出宝贵时间回答,

Nick Z.


Nick Z.写道:
Thanks,
I cant believe I overlooked this.
I even played with the Encoding enumeration before and it didnt work for
me for some reason, works now...

Thanks for taking the time to answer,
Nick Z.

Nick Z. wrote:
我有一个文件,我想从中读取UTF-16 unicode字符串。
最简单的方法是什么?

谢谢提前,
Nick Z。
I have a file that I want to read a UTF-16 unicode string from.
What is the easiest way to accomplish that?

Thanks in advance,
Nick Z.



这篇关于需要有关unicode字符串的帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆