473,657 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convertabilty String to extended ASCII

dzenanz
45 New Member
If someone comes by the same problem as me (converting string to 8-bit ascii codes), here is the solution:

Expand|Select|Wrap|Line Numbers
  1. String s="ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ";
  2. byte ascii[]=s.getBytes("Cp437");
Cp437 can be replaced by IBM437, but not by Windows-1252, Latin1, US-ASCII (this is 7-bit ascii) and ISO-8859-1.

My problem was that I was trying to use "ISO-8859-1" (being nice standards-compliant guy), "ISO_8859_1 ", "8859_1" and such, instead going immediately for the code page 437 (DOS-US, OEM-DOS).

I hope this will help someone.
Apr 4 '08 #1
1 7300
BigDaddyLH
1,216 Recognized Expert Top Contributor
If someone comes by the same problem as me (converting string to 8-bit ascii codes), here is the solution:

Expand|Select|Wrap|Line Numbers
  1. String s="ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ";
  2. byte ascii[]=s.getBytes("Cp437");
Cp437 can be replaced by IBM437, but not by Windows-1252, Latin1, US-ASCII (this is 7-bit ascii) and ISO-8859-1.

My problem was that I was trying to use "ISO-8859-1" (being nice standards-compliant guy), "ISO_8859_1 ", "8859_1" and such, instead going immediately for the code page 437 (DOS-US, OEM-DOS).

I hope this will help someone.
I guess it all hinges on how one defines "extended ASCII".
Apr 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
505
by: john | last post by:
On my form i have a message box called txtItemDesc that displays the french phrase qualité Père Noël. Now then when i run this code on that text box: Dim chrArr() As Char chrArr = txtItemDesc.Text.ToCharArray Dim pos As Integer While pos < chrArr.Length Dim c As Char MsgBox(Asc(chrArr(pos)) & " " & chrArr(pos)) pos = pos + 1
18
5605
by: Zygmunt Krynicki | last post by:
Hello I've browsed the FAQ but apparently it lacks any questions concenring wide character strings. I'd like to calculate the length of a multibyte string without converting the whole string. Zygmunt PS: The whole multibyte string vs wide character string concept is broken IMHO since it allows wchar_t not to be large enough to contain a full character (rendering both types virtually the same). What's the point of
11
17403
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected internal string StringToAscii(string S) { byte strArray = Encoding.UTF7.GetBytes(S); string NewString = Encoding.UTF7.GetString(strArray);
3
276676
by: pkumar | last post by:
How to convert this byte array to string byte b=new byte; Is there any function or I need read one by one and build the string thanks
18
34116
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
3
5153
by: quat | last post by:
Hi, I have a char* string where I assigned a string literal with the British pound symbol, which is included in the extended ASCII, at least on my OS. However, when I cout the string, I get a modified u in place of the pound symbol. Why is that? If I output the ASCII code of the pound symbol it outputs just fine--but not when in a char*.
18
9050
by: John | last post by:
Hi, I'm a beginner is using C# and .net. I have big legacy files that stores various values (ints, bytes, strings) and want to read them into a C# programme so that I can store them in a database. The files are written by a late 1980's PC Pascal programme, for which I don't have the source code. I've managed to reverse engineer the file format. The strings are stored as Ascii in the file, with the first byte indicating the string...
6
2166
by: AG | last post by:
I have a file that contains ASCII and Extended ASCII characters. I need to get the file contents into a string, but the Extended ASCII characters (dec 128 and 129) are being changed to dec 63. I have tried several methods, but here is the one I thought would have worked. Dim strReturn As String Dim arBytes() As Byte arBytes = System.IO.File.ReadAllBytes(<myfile>)
13
48065
by: ramif | last post by:
Is there a way to print extended ASCII in C?? I tried to code something, but it only displays strange symbols. here is my code: main() { char chr = 177; //stores the extended ASCII of a symbol printf("Character with an ascii code of 177: %c \n", chr); //tries to print an ASCII symbol...
0
8385
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
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
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
8602
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...
1
6162
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.