473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Encoding Umlaut becomes ? when using System.Text.Encoding.ASCII

I am trying to take in ASCII documents and convert them into ANSI for a
customer in Germany. But every file I process turns umlauts and other
german characters into something other then what it was.

Here is some real simple console code. It seems like umlauts are not in
ASCII, but they are.

StreamWriter swExport = new StreamWriter("C:\\MyDocuments\\In
Progress\\IIR\\OUT.txt",false,System.Text.Encoding .ASCII);
swExport.WriteLine("Ö");
swExport.Close();
The output is a ?

Has anyone worked with German characters and ASCII -> ANSI encoding.
Thanks for any help.

Chris Auer

Nov 17 '05 #1
3 9654
Hi,

Chris Auer wrote:
Here is some real simple console code. It seems like umlauts are not
in ASCII, but they are.


No, they are not. ASCII only uses 7 bits and includes character values up
to 127; if you look at any character table, you will notice that there are
no accented characters in that range. They are instead contained in the
various (depending on language) 8-bit ISO code pages that are ASCII
compatible in the lower half, but define characters up to 255.

Try System.Text.Encoding.GetEncoding("ISO-8859-1").
--
Chris Priede
Nov 17 '05 #2
Perfect. Thanks very much for the reply. You have made my day.

Thanks for all the help.

Nov 17 '05 #3
Chris Priede wrote:
Hi,

Chris Auer wrote:
Here is some real simple console code. It seems like umlauts are not
in ASCII, but they are.


No, they are not. ASCII only uses 7 bits and includes character
values up to 127; if you look at any character table, you will notice
that there are no accented characters in that range.


Just a note: There's an entire family of encodings (ISO-646-xx) that
replace certain characters within US-ASCII's 7 bit range for umlaut or
accented characters. These are even available on the Windows platform
and the .NET framework. See http://czyborra.com/charsets/iso646.html
for more information.

Thus, "7 bit" does not really imply "no umlauts", it's just that the
term "7 bit" has practically become a synonym for US-ASCII for all
practical purposes on UNIX and Windows platforms.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 17 '05 #4

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

Similar topics

2
by: Mark | last post by:
Sorry about the last... Anyway, here's the question: I've been working on some C# routines to process strings in and out of various encodings. The hope is that I can just let the user type in...
4
by: I.Charitopoulos | last post by:
The reason I want to do so, is that I am sending to DOS and I am pretty certain that it will not work. Everything I've tried so far hasnt. In my test environment (Windows to Windows) this works...
1
by: Emilio | last post by:
Question about Dim data As () = System.Text.Encoding.ASCII.GetBytes(message) Would it be the same to write: Dim data() As Byte = System.Text.Encoding.ASCII.GetBytes(message) ?
4
by: George | last post by:
Hi, I am puzzled by the following and seeking some assistance to help me understand what happened. I have very limited encoding knowledge. Our SAP system writes out a text file which includes...
4
by: A_StClaire_ | last post by:
hi, I am using the following code to download multiple file types from a server. .txt files transfer fine. however Word .doc files come through garbled and I don't know enough about encoding...
8
by: > Adrian | last post by:
How do I use System.Text.Encoding.Default in conjunction with "append"? The objective being not to get into all sorts of problems with special ASCII characters like é etc. Many thanks, Adrian.
3
by: =?Utf-8?B?RGFu?= | last post by:
When I use the following code I get "???" in place of the non-Ascii character. Is there any way to fix the conversion or do I have to write a function to search for "???" and replace with another...
4
by: DR | last post by:
When using System.IO.FileStream, I write 8 bytes, then seek to the start of the file, does the 8 bytes get flushed on seek and the buffer become a readbuffer at that point instead of being a write...
1
by: Lloyd Dupont | last post by:
I think you could test that for your self, couldn't you! ;-) VS is a good hexa editor, if you want to do some hexa read of your file... "DR" <softwareengineer98037@yahoo.comwrote in message...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.