473,804 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ascii

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
Nov 20 '05 #1
19 2330
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

Nov 20 '05 #2
No, the ascii encoding only takes 7 bits, for a + umlaut you need 8 bits.
Frank
"Anand[MVP]" <An******@discu ssions.microsof t.com> wrote in message
news:21******** *************** ***********@mic rosoft.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

Nov 20 '05 #3
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.
Nov 20 '05 #4
No, it doesn't. a + umlaut is written something like Ã".
Frank

"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:#m******** ******@TK2MSFTN GP11.phx.gbl...
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.

Nov 20 '05 #5
No, it doesn't. a + umlaut is written something like Ã".


So which encoding are you using, and which tool are you then checking
the result with?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #6
* "Frank" <fr***@frank.co m> scripsit:
No, the ascii encoding only takes 7 bits, for a + umlaut you need 8 bits.
Frank


Depending on where you live, pass 'Encoding.Defau lt' to the
'StreamWriter's constructor.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #7
I tried several encoding settings in streamwriter. None gave me a+umlaut.
Frank

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:e8******** ******@TK2MSFTN GP12.phx.gbl...
* "Frank" <fr***@frank.co m> scripsit:
No, the ascii encoding only takes 7 bits, for a + umlaut you need 8 bits. Frank


Depending on where you live, pass 'Encoding.Defau lt' to the
'StreamWriter's constructor.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #8
* "Frank" <fr***@frank.co m> scripsit:
I tried several encoding settings in streamwriter. None gave me a+umlaut.


What application to you use to take a look at the file?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #9
does it matter? I checked with a hexeditor.
Frank
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:#K******** *****@TK2MSFTNG P12.phx.gbl...
* "Frank" <fr***@frank.co m> scripsit:
I tried several encoding settings in streamwriter. None gave me
a+umlaut.
What application to you use to take a look at the file?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
10177
by: chandy | last post by:
Hi, I have an Html document that declares that it uses the utf-8 character set. As this document is editable via a web interface I need to make sure than high-ascii characters that may be accidentally entered are properly represented when the document is served. My programming language allows me to get the ascii value for any individual character so what I am doing when a change is saved is to look at each character in the content and...
2
6206
by: Martín Marconcini | last post by:
Hello there, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program (its name i cannot recall now...) where I designed the "screen" using this "program" and then saved it into an ASCII file. (thus, using 'extended' ASCII's like Lines, Corners, etc. and making screens look nicer and more professional). Then reading a...
18
34151
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found Encoding.Convert, but that needs byte arrays. Thanks, /Ger
399
12977
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or to python-3000@python.org In summary, this PEP proposes to allow non-ASCII letters as identifiers in Python. If the PEP is accepted, the following identifiers would also become valid as class, function, or variable names: Löffelstiel,...
9
4150
by: =?Utf-8?B?RGFu?= | last post by:
I have the following code section that I thought would strip out all the non-ascii characters from a string after decoding it. Unfortunately the non-ascii characters are still in the string. What am I doing wrong? Dim plainText As String plainText = "tâ•e" Dim plainTextBytes() As Byte Dim enc As Encoding = Encoding.ASCII plainTextBytes = enc.GetBytes(plainText)
0
9712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.