ASCII [英] ascii

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

问题描述



什么IO类或编码将+ umlaut(?)作为1个字符写入文件?

看起来像流写者不是,我应该使用二进制文件?

提前付款

弗兰克

解决方案

变音字符是一个单一的字节字符,但.NET中的字符串默认为Unicode字符串。也许尝试使用ASCII编码器(查看ASCIIEncoding类)然后写入流。


Rgds,

Anand

VB.NET MVP
http://www.dotnetindia.com


" Frank"写道:


什么IO类或编码将+ umlaut(?¤)作为1个字符写入文件?
看起来像流写者不要'' t,我应该使用二进制文件吗?
Thanx提前
Frank



不,ascii编码只需要7比特,对于+变音符号,您需要8位。

Frank

Anand [MVP]" <安****** @ discussions.microsoft.com>在留言中写道

news:21 ********************************** @ microsof t.com ...

变音字符是单字节字符,但.NET中的字符串默认为
Unicode字符串。也许尝试使用ASCII编码器(查看

ASCIIEncoding类)然后写入流。
Rgds,
Anand
VB.NET MVP http://www.dotnetindia.com

"弗兰克"写道:


什么IO类或编码将+ umlaut(?)作为1个字符写入
文件?看起来像流写者不是,我应该使用二进制文件吗?
Thanx提前
Frank



< blockquote>

看起来像streamwriters不是,我应该使用二进制文件吗?




只要你用它初始化它就可以找到StreamWriter

适当的编码。


Mattias


-

Mattias Sj? gren [MVP] mattias @ mvps.org
http://www.msjogren。 net / dotnet / | http://www.dotnetinterop.com

请回复到新闻组。


Hi,
what IO class or encoding writes a + umlaut (?) as 1 character to a file?
Looks like streamwriters don''t, should I use binarywriter?
Thanx in advance
Frank

解决方案

The umlaut character is a single byte character, but strings in .NET are by default Unicode strings. Maybe try using the ASCII encoder(look at the ASCIIEncoding class) and then writing to the stream.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Frank" wrote:

Hi,
what IO class or encoding writes a + umlaut (?¤) as 1 character to a file?
Looks like streamwriters don''t, should I use binarywriter?
Thanx in advance
Frank



No, the ascii encoding only takes 7 bits, for a + umlaut you need 8 bits.
Frank
"Anand[MVP]" <An******@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.com...

The umlaut character is a single byte character, but strings in .NET are by default Unicode strings. Maybe try using the ASCII encoder(look at the
ASCIIEncoding class) and then writing to the stream.
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Frank" wrote:

Hi,
what IO class or encoding writes a + umlaut (?) as 1 character to a file? Looks like streamwriters don''t, should I use binarywriter?
Thanx in advance
Frank



Looks like streamwriters don''t, should I use binarywriter?



StreamWriter should work find as long as you initialize it with the
appropriate Encoding.

Mattias

--
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


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

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