ISO-Latin Encoding

G

Guest

I am trying to write a for loop that will print all the ISO-Latin characters
to a database. However: I am not sure exactly how to go about printing the
ISO-Latin character set. Would anyone be able to give me some pointers? I
think I have to use Encoding eISOLatin = Encoding.GetEncoding(28591); but
after this: I am a bit lost.

Thanks
Andy
 
J

Jon Skeet [C# MVP]

Andy said:
I am trying to write a for loop that will print all the ISO-Latin characters
to a database. However: I am not sure exactly how to go about printing the
ISO-Latin character set. Would anyone be able to give me some pointers? I
think I have to use Encoding eISOLatin = Encoding.GetEncoding(28591); but
after this: I am a bit lost.

It would help if you'd say exactly what you mean by "printing" to a
database.

I suspect you don't need an encoding at all though - if your database
understands Unicode appropriately, you should just be able to write all
the characters to the database as strings. The exact range of
ISO-Latin-1 is somewhat interesting - the Unicode standard implies that
it's Unicode values 0-255, but I believe it's *actually* 32-127 and
160-255.
 
G

Guest

Jon:

I have been tasked with writing a small app to print all ISO-Latin
characters into an AS/400 table, so that we are able to assertain which come
through correctly and which ones we can support from .Net through to the
AS/400. I was told that we did'nt want ANSCII characters, as they would be
truncated.

I am lost on how to exactly print the ISO-Latin values so that when inserted
into a table on our AS/400, we can determine which are supportable.

I hope this helps further explain the issue.

Thanks
Andy
 
J

Jon Skeet [C# MVP]

Andy said:
I have been tasked with writing a small app to print all ISO-Latin
characters into an AS/400 table, so that we are able to assertain which come
through correctly and which ones we can support from .Net through to the
AS/400. I was told that we did'nt want ANSCII characters, as they would be
truncated.

What do you mean by "ANSCII"? Do you mean ASCII, or ANSI?
I am lost on how to exactly print the ISO-Latin values so that when inserted
into a table on our AS/400, we can determine which are supportable.

I still don't know what you mean by "printing" a character into a
table. Do you just mean inserting a string value into a table? If so,
just create a parameterised SQL statement which inserts the parameter
into the table, and call it repeatedly, once per character in the
ranges 32-127 and 160-255. (Alternatively, call it once with a string
with all those characters in - I think the former would make it easier
to work out what doesn't work though, especially if you include a
second parameter which is an integer, the Unicode value you're
inserting.)
 
G

Guest

Jon:

Thanks again for the response, but I am still a little lost. I am not sure
how to format the SQL string for insertion into the table. I have tried
various scenarios, and nothing has seemed to work.

Here is my code, perhaps that will help:

Encoding eISOLatin = Encoding.GetEncoding(28591);
for(int i = 160; i <= 255; i++)
{
sSQL = "INSERT INTO tEncoding(s_Encoding) VALUES ('')";
oCommand.CommandText = sSQL;
oCommand.ExecuteNonQuery();
}


Thanks
Andy
 
J

Jon Skeet [C# MVP]

Andy said:
Thanks again for the response, but I am still a little lost. I am not sure
how to format the SQL string for insertion into the table. I have tried
various scenarios, and nothing has seemed to work.

Here is my code, perhaps that will help:

Encoding eISOLatin = Encoding.GetEncoding(28591);
for(int i = 160; i <= 255; i++)
{
sSQL = "INSERT INTO tEncoding(s_Encoding) VALUES ('')";
oCommand.CommandText = sSQL;
oCommand.ExecuteNonQuery();
}

Okay, well as I said, you don't need to use an encoding.

You should change your SQL so that it has a parameter (the exact
details of which will depend on the database driver) and then set the
parameter to a string value:

string characterAsString = Convert.ToString((char)i);
 
M

Michael S

Andy.

Jon gave the solution. But my question is;

- Why would you want do this?

I struggled for minutes now (ages for me), and I can't think of a single
application or feature that would want a couple of chars in a table. Do tell
us... please...

Curious
- Michael S
 
G

Guest

Mike:

It is a long drawnout process: but we take orders online. We have
international orders that need special characters, and some logos use special
characters that MUST be on the item ordered. In order to get to our
printing system: the orders must go through various steps and applications
(some very poor third party applications). We want to run a test through the
entire process all the way to our AS/400 so that we can advertsie which
special characters can be processed from start to finish.

I have been charged with doing this test.

I hope this answers your question.
 
G

Guest

Jon:

Thanks for the help and patience. I got way lost when my boss said it had
to be the ISO-Latin set. Thanks for all the help.

Andy
 
M

Michael S

Andy said:
I have been charged with doing this test.

We feel sorry for you. I hope you get paid a lot for doing this.
If not, your manager hates you and it's time to look for better job. =)

Happy Coding
- Michael S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top