Home > Archive > SQL Anywhere database > April 2005 > Simple Codepage Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Simple Codepage Question
Tejonath

2005-04-15, 9:23 am

Hi All,
I'm using ASA802.4272 and have a simple code page question.

I'm using a 'WinXP Professional' system with 'Regional and
Language Options' set to 'English(U.S.)'.
XP's Active Code Page is set to '437' by default. I created
a new database using the dbinit cmd without any codepage
switch & the resulting database has the CharSet and
Collation properties set to 'cp1252' and '1252LATIN1'
respectively! instead of 'cp437' and '437LATIN1'!!

Why does this happen & what can be done to correct this
behavior. Also, when I created a new database with 'dbinit
-z 437LATIN1' switch, the Database had the right property
values but the Server properties Charset and
DefaultCollation where still set to 'cp1252' and
'1252LATIN1' respectively! So what can be done to ensure
that the Server, Database, & the OS codepages are in
harmony!

(Couldn't find a clear answer after scouring the newsgroup.)

Thank you
Tejonath
John Smirnios

2005-04-15, 11:23 am

The ANSI code page on US English Windows is 1252. The ANSI code page is
used by all (non-Unicode) GUI applications.

The OEM code page on US English Windows is 437. The OEM code page is
only used by console applications.

ASA assumes that Windows applications are typically GUI applications and
therefore chooses the ANSI code page when creating a database.

-john.

--
John Smirnios
Senior Software Developer
iAnywhere Solutions Engineering

Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
Developer Community at http://www.ianywhere.com/developer

Tejonath wrote:
> Hi All,
> I'm using ASA802.4272 and have a simple code page question.
>
> I'm using a 'WinXP Professional' system with 'Regional and
> Language Options' set to 'English(U.S.)'.
> XP's Active Code Page is set to '437' by default. I created
> a new database using the dbinit cmd without any codepage
> switch & the resulting database has the CharSet and
> Collation properties set to 'cp1252' and '1252LATIN1'
> respectively! instead of 'cp437' and '437LATIN1'!!
>
> Why does this happen & what can be done to correct this
> behavior. Also, when I created a new database with 'dbinit
> -z 437LATIN1' switch, the Database had the right property
> values but the Server properties Charset and
> DefaultCollation where still set to 'cp1252' and
> '1252LATIN1' respectively! So what can be done to ensure
> that the Server, Database, & the OS codepages are in
> harmony!
>
> (Couldn't find a clear answer after scouring the newsgroup.)
>
> Thank you
> Tejonath


Tejonath

2005-04-15, 11:23 am

Thanks for the response John,
That explains why the Database CharSet & Collation were set
to 1252 by default. I can set them to 437 using the -z
switch on dbinit. But how can I set the Server CharSet &
DefaultCollation properties to 437. And what's the relation
between the Server codepage properties vs those of the
Database

Thanks & appreciate your help
Tejonath

> The ANSI code page on US English Windows is 1252. The ANSI
> code page is used by all (non-Unicode) GUI applications.
>
> The OEM code page on US English Windows is 437. The OEM
> code page is only used by console applications.
>
> ASA assumes that Windows applications are typically GUI
> applications and therefore chooses the ANSI code page
> when creating a database.
>
> -john.
>
> --
> John Smirnios
> Senior Software Developer
> iAnywhere Solutions Engineering
>
> Whitepapers, TechDocs, bug fixes are all available through
> the iAnywhere Developer Community at
> http://www.ianywhere.com/developer
>
> Tejonath wrote:
>

John Smirnios

2005-04-15, 1:23 pm

Client applications inform the server of the ANSI code page of the
client when they connect. If you you are writing a console application
and really, really want to cp437 data on the client side, add
"charset=cp437" to your connection string. That will change your
connection_property(
'CharSet' ). If you are writing a GUI application,
I can pretty much assure you that you want cp1252, NOT cp437. If you are
going to look at the output from your database in a GUI application
(even something such as notepad), you want cp1252, not cp437. If your
console program is going to accept input from files created by a GUI
application such as any GUI text editor, you want cp1252, not cp437.
It's very rare, in fact, that you would want a cp437 database or cp437
data on the client. Also note that the ASCII portion of both 1252 and
437 are the same so if it is really necessary for you to use cp437 then
I'd guess that you are planning to store things such as graphic
box-drawing characters or some Greek characters which exist in 437 but
not in 1252.

You cannot change the server property given by property( 'CharSet' )
because the server is a GUI app and its charset is 1252. Well, strictly
speaking you can change it by changing your locale to non-US-English and
then rebooting your machine.

You cannot change property( 'DefaultCollation' ). It is based on the
OS's ANSI code page which in your case is cp1252. Default collation is
only used when you create a new database. As with anything, if you don't
want the default you will need to specify explicitly what you want.

-john.

--
John Smirnios
Senior Software Developer
iAnywhere Solutions Engineering

Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
Developer Community at http://www.ianywhere.com/developer

Tejonath wrote:
[color=darkred]
> Thanks for the response John,
> That explains why the Database CharSet & Collation were set
> to 1252 by default. I can set them to 437 using the -z
> switch on dbinit. But how can I set the Server CharSet &
> DefaultCollation properties to 437. And what's the relation
> between the Server codepage properties vs those of the
> Database
>
> Thanks & appreciate your help
> Tejonath
>
>


Tejonath

2005-04-15, 8:23 pm

John, Thanks for your help.
Will keep in mind the insights.

Have a fun weekend.
Tejo

> Client applications inform the server of the ANSI code
> page of the client when they connect. If you you are
> writing a console application and really, really want to
> cp437 data on the client side, add "charset=cp437" to
> your connection string. That will change your
> connection_property(
'CharSet' ). If you are writing a GUI
> application, I can pretty much assure you that you want
> cp1252, NOT cp437. If you are going to look at the output
> from your database in a GUI application (even something
> such as notepad), you want cp1252, not cp437. If your
> console program is going to accept input from files
> created by a GUI application such as any GUI text editor,
> you want cp1252, not cp437. It's very rare, in fact, that
> you would want a cp437 database or cp437 data on the
> client. Also note that the ASCII portion of both 1252 and
> 437 are the same so if it is really necessary for you to
> use cp437 then I'd guess that you are planning to store
> things such as graphic box-drawing characters or some
> Greek characters which exist in 437 but not in 1252.
>
> You cannot change the server property given by property(
> 'CharSet' ) because the server is a GUI app and its
> charset is 1252. Well, strictly speaking you can change
> it by changing your locale to non-US-English and then
> rebooting your machine.
>
> You cannot change property( 'DefaultCollation' ). It is
> based on the OS's ANSI code page which in your case is
> cp1252. Default collation is only used when you create a
> new database. As with anything, if you don't want the
> default you will need to specify explicitly what you want.
>
> -john.
>
> --
> John Smirnios
> Senior Software Developer
> iAnywhere Solutions Engineering
>
> Whitepapers, TechDocs, bug fixes are all available through
> the iAnywhere Developer Community at
> http://www.ianywhere.com/developer
>
> Tejonath wrote:
>
> ANSI >>code page is used by all (non-Unicode) GUI
> applications. >>
> through >>the iAnywhere Developer Community at
> CharSet >>>and Collation properties set to 'cp1252' and
> right >>>property values but the Server properties Charset
> and >>>DefaultCollation where still set to 'cp1252' and
> ensure >>>that the Server, Database, & the OS codepages
> are in >>>harmony!
>
>

Tejonath

2005-04-15, 8:23 pm

John, Thanks for your help.
Will keep in mind the insights.

Have a fun weekend.
Tejonath


> Client applications inform the server of the ANSI code
> page of the client when they connect. If you you are
> writing a console application and really, really want to
> cp437 data on the client side, add "charset=cp437" to
> your connection string. That will change your
> connection_property(
'CharSet' ). If you are writing a GUI
> application, I can pretty much assure you that you want
> cp1252, NOT cp437. If you are going to look at the output
> from your database in a GUI application (even something
> such as notepad), you want cp1252, not cp437. If your
> console program is going to accept input from files
> created by a GUI application such as any GUI text editor,
> you want cp1252, not cp437. It's very rare, in fact, that
> you would want a cp437 database or cp437 data on the
> client. Also note that the ASCII portion of both 1252 and
> 437 are the same so if it is really necessary for you to
> use cp437 then I'd guess that you are planning to store
> things such as graphic box-drawing characters or some
> Greek characters which exist in 437 but not in 1252.
>
> You cannot change the server property given by property(
> 'CharSet' ) because the server is a GUI app and its
> charset is 1252. Well, strictly speaking you can change
> it by changing your locale to non-US-English and then
> rebooting your machine.
>
> You cannot change property( 'DefaultCollation' ). It is
> based on the OS's ANSI code page which in your case is
> cp1252. Default collation is only used when you create a
> new database. As with anything, if you don't want the
> default you will need to specify explicitly what you want.
>
> -john.
>
> --
> John Smirnios
> Senior Software Developer
> iAnywhere Solutions Engineering
>
> Whitepapers, TechDocs, bug fixes are all available through
> the iAnywhere Developer Community at
> http://www.ianywhere.com/developer
>
> Tejonath wrote:
>
> ANSI >>code page is used by all (non-Unicode) GUI
> applications. >>
> through >>the iAnywhere Developer Community at
> CharSet >>>and Collation properties set to 'cp1252' and
> right >>>property values but the Server properties Charset
> and >>>DefaultCollation where still set to 'cp1252' and
> ensure >>>that the Server, Database, & the OS codepages
> are in >>>harmony!
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com