Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Unicode to ANSI

3 posts in Objects Last posting was on 2007-09-05 02:38:56.0Z
AD Posted on 2007-09-04 21:17:55.0Z
Sender: 6974.46ddca92.1804289383@sybase.com
From: AD
Newsgroups: sybase.public.powerbuilder.objects
Subject: Unicode to ANSI
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <46ddcb83.6988.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Sep 2007 14:17:55 -0700
X-Trace: forums-1-dub 1188940675 10.22.241.41 (4 Sep 2007 14:17:55 -0700)
X-Original-Trace: 4 Sep 2007 14:17:55 -0700, 10.22.241.41
Lines: 4
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9444
Article PK: 736603

Can anyone help me as to how I can convert a string from
Unicode to ANSI in Powerbuilder 10.5 ?

Thanks so much


Doug Porter Posted on 2007-09-04 22:45:24.0Z
From: "Doug Porter" <doug_porterATdailyaccessDOTnospamDOTcom>
Newsgroups: sybase.public.powerbuilder.objects
References: <46ddcb83.6988.1681692777@sybase.com>
Subject: Re: Unicode to ANSI
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 29-197-171-12-host.dailyaccess.com
X-Original-NNTP-Posting-Host: 29-197-171-12-host.dailyaccess.com
Message-ID: <46dde004$1@forums-1-dub>
Date: 4 Sep 2007 15:45:24 -0700
X-Trace: forums-1-dub 1188945924 12.171.197.29 (4 Sep 2007 15:45:24 -0700)
X-Original-Trace: 4 Sep 2007 15:45:24 -0700, 29-197-171-12-host.dailyaccess.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9446
Article PK: 736605

You can get there via the Blob function (not sure if there is a
simpler way).

// given some Unicode encoded String ls_my_unicode_string
String ls_my_new_ansi_string

ls_my_new_ansi_string = String(Blob(ls_my_unicode_string,
EncodingANSI!), EncodingANSI!)

Doug Porter
DailyAccess Corporation

<AD> wrote in message news:46ddcb83.6988.1681692777@sybase.com...
> Can anyone help me as to how I can convert a string from
> Unicode to ANSI in Powerbuilder 10.5 ?
>
> Thanks so much


Jim O'Neil [Sybase] Posted on 2007-09-05 02:38:56.0Z
From: "Jim O'Neil [Sybase]" <joneil@sybase.com>
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: Unicode to ANSI
Message-ID: <p15sd3ho84ui4a4j3rd11mnst1qco3qe77@4ax.com>
References: <46ddcb83.6988.1681692777@sybase.com> <46dde004$1@forums-1-dub>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vpneast-client-001.sybase.com
X-Original-NNTP-Posting-Host: vpneast-client-001.sybase.com
Date: 4 Sep 2007 19:38:56 -0700
X-Trace: forums-1-dub 1188959936 10.18.242.8 (4 Sep 2007 19:38:56 -0700)
X-Original-Trace: 4 Sep 2007 19:38:56 -0700, vpneast-client-001.sybase.com
Lines: 37
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:9447
Article PK: 736604

Well that actually doesn't do anything useful. Strings are stored in
UCS-2 (aka UTF-16) format in PB. The code below will convert a UCS-2
string to a blob in ANSI format (i.e., the blob will take up 1/2 the
number of bytes as the string), then convert the blob back from an
ANSI format to a string, but the resulting string is UCS-2 and will
always be stored as UCS-2 in PowerBuilder.

Note that in your code below, PowerBuilder will evaluate the condition
ls_my_new_ansi_string = ls_my_unicode_string as TRUE.

I'd ask the OP what he's trying to accomplish... it's reasonable that
he might have to pass the UCS-2 string to some external routine that
expects an ANSI string - hence the ";ANSI" suffix on external function
call declarations. DDE is another place where passing ANSI strings
may be required.

On 4 Sep 2007 15:45:24 -0700, "Doug Porter"

<doug_porterATdailyaccessDOTnospamDOTcom> wrote:

>You can get there via the Blob function (not sure if there is a
>simpler way).
>
>// given some Unicode encoded String ls_my_unicode_string
>String ls_my_new_ansi_string
>
>ls_my_new_ansi_string = String(Blob(ls_my_unicode_string,
>EncodingANSI!), EncodingANSI!)
>
>Doug Porter
>DailyAccess Corporation
>
><AD> wrote in message news:46ddcb83.6988.1681692777@sybase.com...
>> Can anyone help me as to how I can convert a string from
>> Unicode to ANSI in Powerbuilder 10.5 ?
>>
>> Thanks so much
>