By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,696 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,696 IT Pros & Developers. It's quick & easy.

ISO-Latin Encoding

P: n/a
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
Nov 17 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Andy <An**@discussions.microsoft.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2

P: n/a
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

"Jon Skeet [C# MVP]" wrote:
Andy <An**@discussions.microsoft.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #3

P: n/a
Andy <An**@discussions.microsoft.com> wrote:
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.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

P: n/a
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
"Jon Skeet [C# MVP]" wrote:
Andy <An**@discussions.microsoft.com> wrote:
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.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #5

P: n/a
Andy <An**@discussions.microsoft.com> wrote:
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);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #6

P: n/a
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
Nov 17 '05 #7

P: n/a
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.

"Michael S" wrote:
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

Nov 17 '05 #8

P: n/a
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

"Jon Skeet [C# MVP]" wrote:
Andy <An**@discussions.microsoft.com> wrote:
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);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #9

P: n/a

"Andy" <An**@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...

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
Nov 17 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.