× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The error indicates that the file is defined as being CCSID 37 (i.e. ebcdic) which would be very very unusual.

You don't show what value you have used for o_ccsid but at some time that file appears to have been created with an incorrect ccdid. Create the file with the right ccdid and you should be fine.



Search Results
Web results

EBCDIC)

On Aug 20, 2020, at 3:03 PM, Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

Barbara,

Here are some of the things I've tried. In all cases I eventually receive a CCSID conversion error.
dcl-s base64encoded varchar(65535) inz;
dcl-s base64decoded char(65535) ccsid(*UTF8) inz;
dcl-s labelUTF varchar(65535) ccsid(*UTF8) inz;
dcl-s labelData varchar(65535) inz;
dcl-s zplEnd char(3) inz('^XZ') ccsid(*UTF8);

base64Encoded = xml.base64label;
len = base64_decode( %addr(base64Encoded:*data)
: %len(%trim(base64Encoded))
: %addr(base64Decoded)
: %size(base64Decoded)
);

labelUTF = %subst(base64Decoded:1:len);

x = %scan(%UCS2('^XZ') : %UCS2(labelUTF));
OR
x = %scan(%UCS2(zplEnd) : %UCS2(labeUTF ));

**An error occurred during conversion from CCSID(1208) to CCSID(13488)**

The scan works (and finds the string) if I change the scan to:
x = %scan(zplEnd : labelUTF);

However, when I go to write the data to an IFS file:
Ifs_DeleteFile(Stmf);
flag = o_wronly + o_creat + o_excl + o_ccsid;
mode = s_irusr + s_iwusr + s_iroth + s_iwoth;
fd = open(Stmf:flag:mode:1208:0);
Ifs_Write(fd:labelUTF);
Ifs_CloseFile(fd);

**An error occurred during conversion from CCSID(1208) to CCSID(37) ** occurs during write().

So I'm back to my original problem of being unable to write() the data to the IFS file.




-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Wednesday, August 19, 2020 9:39 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Manipulating a decoded UTF8 string

On 2020-08-19 1:53 p.m., Greg Wilburn wrote:
Barbara,

Thanks for your explanation... but I'm completely lost. I understand that I have UTF8 data in my RPG variable.

I tried this:
x = %scan(%UCS2('^XZ') : %UCS2(base64decoded));

Result is x = 0.


Did you define your RPG variable with CCSID(*UTF8)? If not, RPG wouldn't
handle %UCS2(base64decoded) correctly.

--
Barbara

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.