473,379 Members | 1,544 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,379 software developers and data experts.

Using code pages

I'm writing strings to an embedded console that only supports Extended ASCII
Code Page 437.
The strings are stored in a lookup table in a database .

My original code is as follows which writes to a memory stream:

System.Text.ASCIIEncoding Encoding = new System.Text.ASCIIEncoding();
MachineIDs.Write(Encoding.GetBytes(EquipmentRecord .LabelID));
MachineIDs.Write('\0');
MachineIDs.Write(Encoding.GetBytes(EquipmentRecord .EnglishDesc));
MachineIDs.Write('\0');
MachineIDs.Write(Encoding.GetBytes(EquipmentRecord .GermanDesc));
MachineIDs.Write('\0');

The above code isn't writing using the correct code page.The german 'ü' char
0xFC is being written as char 0x3F using the above.

How do I specify a code page please?

thanks
Claire
Oct 23 '07 #1
6 1932
Are you after 0x81?
Encoding enc = Encoding.GetEncoding(437);
char[] c = { (char)0xFC};
byte[] bytes = enc.GetBytes(c);

Marc
Oct 23 '07 #2
(for reference, I only used the char[] syntax to avoid the character
getting corrupted between your client and mine... strings should work
fine too)

Marc
Oct 23 '07 #3
thanks marc :-)

"Marc Gravell" <ma**********@gmail.comwrote in message
news:eC**************@TK2MSFTNGP05.phx.gbl...
Oct 23 '07 #4
On Oct 23, 12:06 pm, "Marc Gravell" <marc.grav...@gmail.comwrote:
(for reference, I only used the char[] syntax to avoid the character
getting corrupted between your client and mine... strings should work
fine too)
One alternative:

string umlaut = "\u00fc";

Just to avoid the char[] stuff.

Jon

Oct 23 '07 #5
you are most welcome
Oct 23 '07 #6
good spot ;-p
Oct 23 '07 #7

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

Similar topics

13
by: Steven Scaife | last post by:
I have decided to re-write the intranet site i created over a year ago. The coding is pretty awful and hard to read cos I made the mistake of not putting comments in or putting crappy comments in...
1
by: E. Tom Jorgenson | last post by:
I've run into a problem on a couple of projects that I think I've identified - but would like confirmation of what I think is going on. Also interested in any fast solutions to fix the user...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
133
by: Alan Silver | last post by:
Hello, Just wondered what range of browsers, versions and OSs people are using to test pages. Also, since I don't have access to a Mac, will I have problems not being able to test on any Mac...
4
by: Hexman | last post by:
Code below ---- I've asked a similar question on this forum earlier. This is a slightly different situation. Previous Question ---- I'm trying to save some specific web pages to disk as...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
5
by: shapper | last post by:
Hello, In this moment I am creating all my aspx pages on my vb.code at runtime. It seems nonsense to have .aspx and .aspx.vb files in my projects. I am considering creating my pages on the...
0
bartonc
by: bartonc | last post by:
Examples of wx.Wizard that I found used explicit names for the pages. Using eval() in a list comprehension, I am able to go through the imported modules by name and call create() in order to get a...
2
by: NvrBst | last post by:
Hello. I posted this problem in the microsoft.public.dotnet.languages.csharp origionally but moving it here since I think it probably belongs here now. I have a blank ASP.NET/C# page with a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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...
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...

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.