Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Field check for "codepage-safe" characters

Former Member
0 Kudos

I need to check a field to make sure it only contains (printable) characters from the good old 7-bit ANSI codepage. This is to make sure that when ALEing the data to non-Unicode systems, which in our environment can have just about any codepage (except Asian ones), all characters are displayable.

In a non-Unicode system, I could cast each character into a hex field and check that its value is smaller than or equal to 7F; in a Unicode system, this doesn't seem to be a suitable approach.

I could of course define a string into which I enter all the allowed characters and then compare with a CO statement; but I'm hoping that somebody has a more elegant solution.

1 ACCEPTED SOLUTION

sridhar_k1
Active Contributor
0 Kudos

Since you've mentioned no asian characters, Assuming the unicode character uses 2bytes, then in big-endian system, check the value is smaller or equal to 007F, in little endian system check the value is smaller or equal to 7F00.

Regards

Sridhar

1 REPLY 1

sridhar_k1
Active Contributor
0 Kudos

Since you've mentioned no asian characters, Assuming the unicode character uses 2bytes, then in big-endian system, check the value is smaller or equal to 007F, in little endian system check the value is smaller or equal to 7F00.

Regards

Sridhar