‎2008 Aug 12 8:14 AM
Hi experts,
i want write data from SAP db to file format in application server..while writing used encoding default as it supposed to work for UTF-8 code but in the file the german characters are creating as double bytes..
Anyone help me out understanding why this german cgaracters are craeting with two bytes in file.
could any one suggest me how can write file with German characters in application server.
Thanks in advance.
Regards
PT
‎2008 Aug 12 8:23 AM
Hi,
I found this in help of ABAP Documentation for UTF-8. this might be helpful to understand what you are observing.
UTF-8
8 bit Unicode character representation. ASCII characters are represented by one byte. Other European characters are represented in 2 bytes. Most Asian characters are represented in 3 bytes. The characters in the surrogate area are addressed directly using 4 bytes.
Regards,
Mohaiyuddin
‎2008 Aug 12 8:23 AM
Hi,
I found this in help of ABAP Documentation for UTF-8. this might be helpful to understand what you are observing.
UTF-8
8 bit Unicode character representation. ASCII characters are represented by one byte. Other European characters are represented in 2 bytes. Most Asian characters are represented in 3 bytes. The characters in the surrogate area are addressed directly using 4 bytes.
Regards,
Mohaiyuddin
‎2008 Aug 12 9:05 AM
Hi Mohaiyuddin ,
Thanks for responce..i read that too western eueopean (Latin-1) are with 2 bytes..
problem here while writing the file in app server other system expecting single byte for the european characters but SAP system producing two bytes .by this it is changing lenghth of the string .
any one faced this type of problem ..could you please advice me what will be the probable solution ..
either i have to change the code or is it not possible with ABAP to produce single byte for the european character.
please advice me.
thansk for your time.
Regards
PT
‎2008 Aug 12 9:22 AM
Hi,
Haven't faced such problem.
Don't know if using encoding NON-UNICODE can solve this problem.
If you are using unicode system that will not work
Moreover you won't be able to set Text Environment in Unicode system
Or else you will need some code for conversion between UTF-8 code to single byte European format, because UTF-16 will write in 2 byte and UTF-32 in 4 byte format.
Is it possible for your target system to read it in UTF-8 format ?
Regards,
Mohaiyuddin
Edited by: Mohaiyuddin Soniwala on Aug 12, 2008 1:59 PM
‎2008 Aug 12 9:32 AM
Hi Mohaiyuddin,
I am creating files in application server of SAP system and when we open the file at unix level it showing the special character with two bytes( its not even showing the character exactly ,showing different format with two bytes ie ü character in SAP showing in file as A1/4 )..
from above i want to show the character as same what ever in the SAP table like ü..
i am using encode default in the code,,,
any suggestions..
thanks for your time.
Regards
PT
‎2008 Aug 12 9:41 AM
> i am using encode default in the code,,,
This is exactly your problem. If your system is a unicode system and it seems to be like that the fedault ist Unicode format.
So got to online help and choose another appropriate encoding.
‎2008 Aug 12 9:43 AM
Hi,
http://www.cl.cam.ac.uk/~mgk25/unicode.html
Some extract form below link also might be helpful
APPLICATION NOTES
Users have to select a UTF-8 locale, for example with
export LANG=en_GB.UTF-8
in order to activate the UTF-8 support in applications.
Application software that has to be aware of the used character encoding should always set the locale with for example
setlocale(LC_CTYPE, "")
and programmers can then test the expression
strcmp(nl_langinfo(CODESET), "UTF-8") == 0
http://linux.about.com/library/cmd/blcmdl7_utf8.htm
http://infoweb.ntnu.no/programs/unix/utf8unixeng.html
Regards,
Mohaiyuddin
‎2008 Aug 13 9:10 AM
HI all,
Thanks for your inputs.now i have an understanding ...
what ever the files Program producing are in ASCII format but it must be in UTF-8 format.
anyone one could give some idea about code used to create UTF-8 format file.
Thanks for your time.
Regards
PT
‎2008 Aug 13 9:15 AM
Just use ENCODING UTF-8 instead of ENCODING DEFAULT.
Regards,
Mohaiyuddin
‎2008 Aug 13 10:10 AM
HI Mohaiyuddin,
Thanks for your reply.but i tried UTF-8 instaed on default that it giving the same output as before.
Thanks
PT.
‎2008 Aug 13 10:18 AM
Hi,
Hope I understand this correctly..
You want to produce a file using ABAP program with UTF-8 format right ?
Remember UTF-8 will always produce 2 bytes for other European characters as i have mentioned above.
Regards,
Mohaiyuddin