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

CP500 EBCDIC encoding bug?

This is probably a fringe programme...

In the past I used a C-program to convert from EBCDIC (CP500)
to ASCII/Unicode. As you might guess, this is simply a 256-byte
lookup table. I lifted it from Larry Wall's perl source, to
be found here:

http://www.nntp.perl.org/group/perl.mvs/735

This worked very well. For some reason, the C# codec for
CP500 does not convert CR/LF (0x15 in EBCDIC) to 0x0A in
ASCII. Instead, it converts to 0x85. The other character
translations look okay. I figured that I might have picked
the wrong encoding, but picking /500/ as code-page for
the ISO standard CP (codepage) 500 is pretty much a
no-brainer. Other EBCDIC encodings from C#'s library
give gross results. So... what gives?

Any experiences from the fringe? Post-processing the
CP500-decoded string by translating the 0x85s to 0x0As
is SLOW in C#.

Jul 3 '06 #1
5 3714
Tin Gherdanarra wrote:
This is probably a fringe programme...

In the past I used a C-program to convert from EBCDIC (CP500)
to ASCII/Unicode. As you might guess, this is simply a 256-byte
lookup table. I lifted it from Larry Wall's perl source, to
be found here:

http://www.nntp.perl.org/group/perl.mvs/735

This worked very well. For some reason, the C# codec for
CP500 does not convert CR/LF (0x15 in EBCDIC) to 0x0A in
ASCII. Instead, it converts to 0x85.
That's the correct encoding according to a source I've used for EBCDIC
before:

http://std.dkuug.dk/i18n/charmaps/500

Note that Unicode U+0085 is "next line" which fits with the description
on the above page.

Jon

Jul 3 '06 #2
"Tin Gherdanarra" <ti*********@gmail.comwrote in message
news:4g*************@individual.net...
Any experiences from the fringe? Post-processing the
CP500-decoded string by translating the 0x85s to 0x0As
is SLOW in C#.
Have a look at this: http://www.yoda.arachsys.com/csharp/ebcdic/

When Mr Skeet logs in a little later, I'm sure he'll have the solution...
Jul 3 '06 #3
Mark Rae <ma**@markN-O-S-P-A-M.co.ukwrote:
"Tin Gherdanarra" <ti*********@gmail.comwrote in message
news:4g*************@individual.net...
Any experiences from the fringe? Post-processing the
CP500-decoded string by translating the 0x85s to 0x0As
is SLOW in C#.

Have a look at this: http://www.yoda.arachsys.com/csharp/ebcdic/

When Mr Skeet logs in a little later, I'm sure he'll have the solution...
I posted a while ago on Google in fact, but it doesn't seem to have
come through yet.

Basically, according to the code charts I've got, the encoding is doing
the right thing - 0x15 is meant to translate to U+0085 (next line), not
U+000A.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 3 '06 #4
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Basically, according to the code charts I've got
Yes, but it's still a bit of a "black art", is it not...?
Jul 3 '06 #5
Mark Rae <ma**@markN-O-S-P-A-M.co.ukwrote:
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Basically, according to the code charts I've got

Yes, but it's still a bit of a "black art", is it not...?
Absolutely. I'd love to see some official specifications, but when I
looked at this a few years ago, the charts at dkuug.org were the only
good references I could find :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 3 '06 #6

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

Similar topics

12
by: John Leslie | last post by:
I need to write a string to a file in EBCDIC. Do I need to do it character by character using a translation table, or is there a function to translate the whole string? (I am aware that I can...
6
by: R.A. | last post by:
Hi Is there some support for this file conversion in c#? Thanks
8
by: Chris H. | last post by:
Is there an easy way to convert a string that is in EBCDIC to ASCII
4
by: Ram | last post by:
Dear All, Good Day I am trying to convert a file which is generated on AS400 with codepage 00420 (arabic & English data combination) with no success. But using the same code( and changing 20420...
9
by: jeff M via .NET 247 | last post by:
I'm still having problems reading EBCDIC files. Currently itlooks like the lower range (0 to 127) is working. I have triedthe following code pages 20284, 20924, 1140, 37, 500 and 20127.By working I...
4
by: Ernie Otero | last post by:
Does anyone know where I can find a function to convert numeric data to overpunch format? I've looked around but I can't seem to find any. Ernie
6
by: Ven | last post by:
Hi, I am reading a kind of below mentioned raw data into my C++ program and writing it out but I want this to be converted into EBCDIC format, how can I accomplish this ? Right now I am using...
1
by: Santiago.Ciciliani | last post by:
Hi all, I'm trying to sort an alphanumerical column as EBCDIC. Reading on Internet I've found two things: a) Use CAST(column as CHAR(nn) CCSID EBCDIC). This gives me the following error: ...
12
by: Andreas Lundgren | last post by:
Hi! Is it determined that the C standard compiler always encode characters with the same character excoding? If for example the functions Foo and Bar are compiled by different compilers, is it...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
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...
0
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...

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.