Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retreive big5 characters from 12.5.3

213 views
Skip to first unread message

Ray

unread,
Dec 14, 2009, 9:04:25 AM12/14/09
to
Hi,

We store Big5 chinese characters string in Sybase 12.5.3 and one of our
systems uses JConnect 6.05
to retreive the string from the database, we need to specify charset=big5 in
connection string such
that the characters are not corrupted.

In ADO.NET, I found the big5 characters are corrupted in .NET (I used Add
Watch to check) and
I think I need to do the same thing in Sybase ADO.NET, I found a post in
this newsgroup which
teach how to specify charset in connection string:

connectionString = "Charset='" + _pcharset +
"';Data Source='" + _pdatasrc +
"';Port='" + _pport +
"';UID='" + _puserid +
"';PWD='" + _ppassword +
"';Database='" + _pdatabase + "';";

Then should I set "Charset=big5" in ADO.NET connection string?

Or I need to do it in C# codes (Just copied from a website):

byte[] bytData = Encoding.Unicode.GetBytes(unicodeString);

Encoding cp950 = System.Text.Encoding.Default;
string codePages = ConfigurationSettings.AppSettings["CodePages"];
try
{
int np = int.Parse(codePages.Trim());
cp950 = Encoding.GetEncoding(np);
}
catch (Exception e )
{
Console.WriteLine( e.Message );
}

byte[] cp950Bytes =
System.Text.Encoding.Convert(System.Text.Encoding.Unicode.....

Thanks for your information in advance,
Raymond


Paul Vero [Sybase]

unread,
Dec 14, 2009, 7:17:41 PM12/14/09
to
Hi Ray,

Try setting the Charset first. See if that works.
If not let me know via this post.

If the native machine can handle this it should work okay.

-Paul

"Ray" <l...@hotmail.com> wrote in message news:4b2645e9@forums-1-dub...

Ray

unread,
Dec 14, 2009, 10:46:46 PM12/14/09
to
If I set to Charset='cp850', then the big5 chinese characters are corrupted.

Please help!

"Ray" <l...@hotmail.com> wrote in message news:4b270619@forums-1-dub...
> Hi Paul,
>
> I set "Charset='big5'" in connection string and the .NET Sybase ADO.NET
> gave this exception:
>
> "Character set conversion is not available between client character set
> 'big5' and server
> character set 'cp850' "
>
> Can you help to check this??? Quite urgent.
>
> Thanks,
> Raymond
>
> "Paul Vero [Sybase]" <pv...@nospam.com> wrote in message
> news:4b26d5a5$1@forums-1-dub...

Ray

unread,
Dec 14, 2009, 10:44:25 PM12/14/09
to
Hi Paul,

I set "Charset='big5'" in connection string and the .NET Sybase ADO.NET gave
this exception:

"Character set conversion is not available between client character set
'big5' and server
character set 'cp850' "

Can you help to check this??? Quite urgent.

Thanks,
Raymond

"Paul Vero [Sybase]" <pv...@nospam.com> wrote in message
news:4b26d5a5$1@forums-1-dub...

Ray

unread,
Dec 14, 2009, 11:40:58 PM12/14/09
to
I guess if JConnect can use charset in connection string to handle this
converion,
then Sybase ADO.NET can do the same thing. Please help.

"Ray" <l...@hotmail.com> wrote in message news:4b2706a6@forums-1-dub...

Ray

unread,
Dec 15, 2009, 4:03:31 AM12/15/09
to
I searched in Internet that specify "CP936" as character set in client may
fix this issue.

I tried this but still failed. Is it the problem of ADO.NET client? Not
update enought?

"Ray" <l...@hotmail.com> wrote in message news:4b2706a6@forums-1-dub...

Ray

unread,
Dec 15, 2009, 8:47:20 PM12/15/09
to
Paul, are you here? I need your help.

"Ray" <l...@hotmail.com> wrote in message news:4b2750e3@forums-1-dub...

Ray

unread,
Dec 15, 2009, 8:52:30 PM12/15/09
to
I try to provide more information before you response me:

version:

Sybase.AdoNet2.AseClient.dll 1.15.192.0
sybdrvado20.dll 1.15.192.0
sybdrvado115.dll 1.15.50.0
sybdrvado115a.dll 1.15.192.0
sybdrvkrb.dll 15.0.0.192
sybdrvssl.dll 15.0.0.192

"Ray" <l...@hotmail.com> wrote in message news:4b283c28@forums-1-dub...

Ray

unread,
Dec 16, 2009, 1:17:10 PM12/16/09
to
Hi Paul,

Have you seen this post? Please help to response.

Thanks,
Raymond

"Paul Vero [Sybase]" <pv...@nospam.com> wrote in message
news:4b26d5a5$1@forums-1-dub...

Paul Vero [Sybase]

unread,
Dec 21, 2009, 4:16:08 PM12/21/09
to
Hi Ray,

Sorry I was away for a while

This Provider is an older Provider. Not sure if an update will help but I
recommend you go to 15.0 ESD#22
or try the newer 15.5 release. There have been changes in 15.5 release in
which by default client (ADO.NET)
uses Server default charset upon login and therefore, during the sesison, or
you can specify client charset and
use the client side character set.

So if using Charset property -

set to "ServerDefault" to see if the ASE default works or set to
"ClientDefault"

If this still sin't working you need to open a tech support case with Sybase
for
further investigation.

Thank you,

-Paul

"Ray" <l...@hotmail.com> wrote in message news:4b283d5e@forums-1-dub...

Ray

unread,
Dec 21, 2009, 9:29:29 PM12/21/09
to
Hi Paul,

Thanks God. You back and I waited for you many days here....

Would you specify more information for using 15.5?

I have following questions now:

1. If I go with 15.0 ESD#22 (I have one on hand now), should I still use
connection string to handle
the character conversion (charset=big5;)? Just like we did in JConnect
connection string?
Or what other ways should I use?

2. For 15.5, please kindly specify the way I should follow? Same usage as
15.0 SDK?
You said client can specify the charset? Any examples/samples to follow?

3. Any new documentation for 15.5 SDK API? Any update?

Really thanks for your help,
Raymond

"Paul Vero [Sybase]" <pv...@nospam.com> wrote in message

news:4b2fe598$1@forums-1-dub...

Ray at home

unread,
Dec 22, 2009, 11:40:18 AM12/22/09
to
This is Raymond at home's post:

I just read the ADO.NET 2.155 in SDK 15.5, there is a CodePageType
property, should I use this instead?

Any example for this property usage?

In the document, it state :

Using an unsupported character set raises this error:
[Sybase][driver] Could not load code page for requested charset
To avoid this error, perform one of the following:

• In your driver’s user interface, go to the Advanced tab and select
ClientCharset as your character set. If you choose Other, ensure that
your specified character set is supported.
• In the connection string, ensure that the charset property specifies
a
supported character set.

If the charset is big5 and not installed in the sybase server, will it
cause this error?

Please help. Thanks,
Raymond

Paul Vero [Sybase]

unread,
Dec 22, 2009, 5:47:19 PM12/22/09
to
Hi Ray,

I'm not sure - you need to have teh charset on ASE to use it I would think.

The idea behind using ClientCharset is to use the machine's charset for
handling the data - what's on the ASE?
What is the ASE character set being used?

-Paul

"Ray at home" <hkp...@gmail.com> wrote in message
news:48d6ff1d-74f8-4cd7...@a10g2000pre.googlegroups.com...

Ray

unread,
Dec 23, 2009, 11:05:08 AM12/23/09
to
But can you help to check with your colleague (anyone supports JConnect?)
why setting charset=big5
in connection string can make the conversion work? (No any client installed
on machine which runs the
JConnect)

By the way, how to check the charset installed on ASE server?

Thanks.

"Paul Vero [Sybase]" <pv...@nospam.com> wrote in message

news:4b314c77$1@forums-1-dub...


> Hi Ray,
>
> I'm not sure - you need to have teh charset on ASE to use it I would
> think.
>
> The idea behind using ClientCharset is to use the machine's charset for
> handling the data - what's on the ASE?
> What is the ASE character set being used?
>
> -Paul
>
> "Ray at home" <hkp...@gmail.com> wrote in message
> news:48d6ff1d-74f8-4cd7...@a10g2000pre.googlegroups.com...
> This is Raymond at home's post:
>
> I just read the ADO.NET 2.155 in SDK 15.5, there is a CodePageType
> property, should I use this instead?
>
> Any example for this property usage?
>
> In the document, it state :
>
> Using an unsupported character set raises this error:
> [Sybase][driver] Could not load code page for requested charset
> To avoid this error, perform one of the following:
>

> ?In your driver�s user interface, go to the Advanced tab and select


> ClientCharset as your character set. If you choose Other, ensure that
> your specified character set is supported.

> ?In the connection string, ensure that the charset property specifies

Paul Vero [Sybase]

unread,
Dec 28, 2009, 1:00:33 PM12/28/09
to
Hi Ray,

On ASE from isql session issue "sp_helpsort" and post output.

I don't know why jConnect works - it might be possible java itself
will support the charset on the client machine -
What sort of client are you using and what is it's locale set for?
What character set is set on the client machine, what language.

Many folks at Sybase are on leave this week in North America.
You might not get an answer right away.

I know the ADO.NET doesn't handle specific charsets internally with
any type of conversions. It handles strings internally as unicode.

It might help to at least verify the ASE is sending the correct information
by using the RIBO TDS tracing utility (%SYBASE%\jutils-2_0\ribo - doc
is included to help setup). At least the RIBO would confirm the ASE is
working okay. My thinking is the Provider isn't supporting the charset
and the only way we could tell is if we had some sort of reproduction to
test with inhouse to see what is going on. This would require the ASE
version,
config for charset and the machine setup where ASE is running.

Also would require information regarding the client machine as well -
windows
version, its charset and language setup, then lastly how you're testing
this - are you
using the samples including in the Windows SDK distribution?

Thank you,

-Paul

"Ray" <l...@hotmail.com> wrote in message news:4b323fb4@forums-1-dub...

Ray at home

unread,
Dec 28, 2009, 1:13:33 PM12/28/09
to
sp_helpsort output:

Collation Name Collation ID
-------------- ------------
defaultml 20
thaidict 21
iso14651 22
utf8bin 24
binary 25
altnoacc 39
altdict 45
altnocsp 46
scandict 47
scannocp 48
dict 51
nocase 52
nocasep 53
noaccent 54
espdict 55
espnocs 56
espnoac 57
rusnocs 59
cyrnocs 64
elldict 65
hundict 69
hunnoac 70
hunnocs 71
turknoac 73
turknocs 74

Loadable Sort Table Name Collation ID
------------------------ ------------
cp932bin 129
dynix 130
gb2312bn 137
cyrdict 140
turdict 155
euckscbn 161
gbpinyin 163
rusdict 165
sjisbin 179
eucjisbn 192
big5bin 194


-
Character Set = 2, cp850
Code Page 850 (Multilingual) character set.
Sort Order = 50, bin_cp850
Binary Sort Order for Code Page 850 (cp850).


-
! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
????????????????????????
 ??????? ????????????????? ? ? ? ? ????? ? ? ? ???
? ? ? ? ? ? ??? ? ? ? ? ? ? ??????? ???? ? ? ? ???
??????????????????? ???????????? ?

My client machine is Windows XP SP2 English Professional, with
regional settings set to
Hong Kong SAR. We have an C# ADO.NET to do a simple SQL select
statement to
retrieve big5 characters from a varchar field.

Any more information required?

Raymond

Ray at home

unread,
Dec 28, 2009, 1:18:13 PM12/28/09
to
Sample C#:

string _conn_str = "Data Source='192.168.19.20';" +
"Port='19990';" +
"UID='user';" +
"PWD='Fed';" +

"Database='db_business';CodePageType='OEM';CharSet='big5';";

AseCommand cmd1 = null;
AseDataReader reader1 = null;

try
{
AseConnection conn1 = new AseConnection();

conn1.ConnectionString = _conn_str;
conn1.Open();

cmd1 = new AseCommand("select email_body from
doc_template where doc_id = 'FR' ", conn1);
cmd1.CommandType = CommandType.Text;

reader1 = cmd1.ExecuteReader();

while (reader1.Read())
{
string content = reader1.GetString(0);
Console.Out.WriteLine(content);
}

conn1.Close();
}
catch (Exception ex)
{
Console.Out.WriteLine("Error : " + ex.ToString());

Ray at home

unread,
Dec 29, 2009, 9:32:38 AM12/29/09
to
Hi Paul,

One point to clarify, I use "text" data type to store the big5 chinese
characters.

Any findings?

Thanks,
Raymond

Paul Vero [Sybase]

unread,
Jan 4, 2010, 6:20:49 PM1/4/10
to
Hi Ray,

I really don't know why this is happening - maybe not supported, maybe some
other configuration.
Your best course of action now is to open a Technical Support case with
Sybase and provide
the information necessary to demonstrate the problem. It sounds like it's
easy to reproduce so if
you get that going then Tech Support can figure out if its just
configuration or get this reported to
Engineering if something needs to be fixed, etc.

Thank you,

-Paul

"Ray at home" <hkp...@gmail.com> wrote in message

news:711d589f-512b-400b...@h10g2000vbm.googlegroups.com...

0 new messages