× 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.



Here is a little example on how to mix SBCS and DBCS ...

http://5.103.128.110:6382/pextcgiCOR/testutf9.pgm



/copy qsrc,pxapihdr
h ccsid(*UCS2 : 1200)
/copy qsrc,pxapicgicn

* Support for CGIDEV2 native subprocedures
/copy qrpglesrc,prototypeb
/copy qrpglesrc,usec
/copy qrpglesrc,variables3

d text s 1024a varying
d japan s 100c varying

d w1208 s 65535a
d w1208len s 10i 0

/free
clearsrvpgm();
setContent('text/html; charset="utf-8"');



// handling of SBCS EBCDIC

text = 'This is a SBCS EBCDIC text combined with japanese characters ';
w1208len = convccsdbcs(%addr(text)+2:%len(text):0:1208
:%addr(w1208):65535);
wrtNoSection(%addr(w1208):w1208len);

// handling of DBCS EBCDIC
japan = u'4E094E957269752332314E094E9577F36CB953165B66';
w1208len = convccsdbcs(%addr(japan)+2:%len(japan)*2:1200:1208
:%addr(w1208):65535);
wrtNoSection(%addr(w1208):w1208len);

echoToStmf('/sean.txt':0);
qcmd('chgatr obj(''/sean.txt'') atr(*ccsid) value(1208)');

echoToClient();

*inlr = *on;
/end-free



On Fri, Jun 6, 2014 at 5:20 PM, McGovern, Sean <Sean.McGovern@xxxxxxxxxxxx>
wrote:

OK, thanks.

I'll give that a go next week.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Henrik
Rützou
Sent: 06 June 2014 16:18
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Emails with Japanese text

Sean,

the CGIDEV2 buffer is SBCS EBCDIC - there is no way to write DBCS EBCDIC
data into it because all procedures has SBCS interfaces.

You can however cheat it to think that strings converted to UTF-8 is SBCS
EBCDIC.

As I wrote - this is tricky!


On Fri, Jun 6, 2014 at 5:08 PM, McGovern, Sean <Sean.McGovern@xxxxxxxxxxxx

wrote:

Sorry, I didn't explain well.

I write the character data to CGIDEV2 buffer, then Unicode data to
buffer, then character data etc.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Henrik Rützou
Sent: 06 June 2014 16:00
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Emails with Japanese text

Sean,

you can't concatenate SBCS and DBCS data in one string. It dosn't make
sense since SBCS only has 256 code points in one byte and DBCS has 64K
code points in two bytes and there is no way you can distingues if a
character is made of one or two bytes in a concatenated string.

UTF-8 is in basic a one to four byte character set that in one byte
encoding shares ASC-II 7 bit character set. UTF-8 has reserved bits in
the first byte that tels how many of the following bytes
(0-3) that creates the "character".

When you convert SBCS EBCDIC to UTF-8 you will get a string where each
character in the EBCDIC field will take up one byte if the caracter is
equal to ASC-II 7 bit otherwise a SBCS will take up typical 2 bytes.

When you convert DBCS EBCDIC to UTF-8 you will get a string where each
character in the EBCDIC field will take up one to four bytes in UTF-8.

The tricky thing is that any field in RPG SBCS or DBCS doesn't hold
characters but only holds hexadecimal/binary values that equals the
character that corresspond to the CCSID of the field/ program ...

$ - EBCDIC SBCS CCSID 37 is x'5B'
Å - EBCDIC SBCS CCSID 37 is x'C5'
$ - EBCDIC SBCS CCSID 277 is x'67'
Å - EBCDIC SBCS CCSID 277 is x'5B' (same value as $ in CCSID 37)

$ - EBCDIC DBCS CCSID 1200 is x'0024'
Å - EBCDIC DBCS CCSID 1200 is x'00C5'

$ - UTF-8 is x'24' (one byte - same as in ASC-II) Å - UTF-8 is x'C385'
(two bytes - in ASC-II x'8F')

$Å - EBCDIC SBCS 37 is x'5BC5'
$Å - EBCDIC SBCS 277 is x'675B'
$Å - EBCDIC DBCS 1200 is x'002400C5'
$Å - UTF-8 is x'24C385'

$Å - concatenated from SBCS and DBCS is x'5B00C5' = garbage!

As you can see of the above it is impossible to concatenate different
EBCDIC CCSID's that will give a hexadecimal meaning but you can always
concatenate after converting to UTF-8.




On Fri, Jun 6, 2014 at 3:35 PM, McGovern, Sean
<Sean.McGovern@xxxxxxxxxxxx

wrote:

Rather than using iconv, is it not easier to concatenate character
and Unicode fields within RPGLE ?

I've tried this also but I still didn't get it right. I created IFS
file in CCSID 5035, but rather than change the attribute to 1208, I
copied it to another stmf, CCSID 1208.



-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Henrik Rützou
Sent: 06 June 2014 14:12
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Emails with Japanese text

What you need to do is the following:

let say you have a EBCDIC SBCS field name 'FieldA' and you have a
EBCDIC DBCS field name FieldB with you chinese characters.

You can then make the following conversions with ICONV into
allocated storage that may be added to the CGIDEV2 output buffer.

FieldA EBCDIC SBCS from 0:1208
FieldB EBCDIC DBCS from 5035:1208

You can then save the buffer into a file with CCSID 65535 or 0 (no
conversion) and make
a change attribute to the IFS file to CCSID 1208.

I have som procedures and a CGIDEV2 version that makes it easier up
and running in beta but it is not fully operational yet.

A proof of concept are here:

http://5.103.128.110:6382/pextcgiCOR/testutf8.pgm








On Fri, Jun 6, 2014 at 2:53 PM, McGovern, Sean
<Sean.McGovern@xxxxxxxxxxxx

wrote:

I'm interested.

I've been creating IFS in CCSID 1208 with automatic translation
form job CCSID to IFS.

I've been formatting the email with: -

----=_Boundary
Content-Type: text/html; charset="UTF-8";
Content-Transfer-Encoding: 8bit



-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Henrik Rützou
Sent: 06 June 2014 13:51
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Emails with Japanese text

Sean

what I think you are trying to do is to mix SBCS and DBCS EBCDIC
into one mime message. This can be done but it is tricky and
requires the end result to be in UTF-8 or UTF-8 EBCDIC

If you are interested I will describe how it is done.


On Fri, Jun 6, 2014 at 2:20 PM, Bradley Stone <bvstone@xxxxxxxxx>
wrote:

Thanks, Sean. PRobably a DBCS issue... I'll see what I can do
on my
end.


On Thu, Jun 5, 2014 at 10:29 AM, McGovern, Sean <
Sean.McGovern@xxxxxxxxxxxx>
wrote:

Brad,

Example text would be: -

三井物産㈱三井石油化学

This is a vendor name. According to Google Translate, this
means "Mitsui
&
Co., Ltd. Mitsui Petrochemical".

Thanks,
Sean


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Bradley Stone
Sent: 05 June 2014 15:47
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Emails with Japanese text

Have you tried our MAITLTOOL command? You can get it from
www.bvstools.com/mailtool.html.

Or, better yet, if you want to send me the text you're trying
to email I'll try it from my machine to see if I can play with
the CCSID settings
to
get it working.

Brad
www.bvstools.com


On Thu, Jun 5, 2014 at 8:46 AM, McGovern, Sean <
Sean.McGovern@xxxxxxxxxxxx

wrote:

I'm sending emails from the IBM i but when these emails
contain Japanese text (from database with CCSID 5035) in
Subject and body of email, the Japanese text is corrupt when
received in
Outlook.

I've tried various ways using combinations of CGIDEV2,
SMTPR4, RPGMail, SNDM. Still haven't got it right.

Is anyone able to provide guidance on how to achieve this
requirement ?

Thanks



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


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


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



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




--
Regards,
Henrik Rützou

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

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




--
Regards,
Henrik Rützou

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

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




--
Regards,
Henrik Rützou

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

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




--
Regards,
Henrik Rützou

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

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





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.