Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XString to String on Unicode-System failed --> cx_sy_conversion_codepage

Former Member
0 Likes
1,857

Hi all,

I'm trying to convert a XString to a String; the content of the string is a png-image. In the past the conversion works, but a few days ago we did an Unicode-Migration of our system and now the conversion fails with the error "CX_SY_CONVERSION_CODEPAGE". I already tried to change the conversion which is used in the create-Method, but everything fails.

I really would appreciate if anybody could help me!

Best regards,

Stefan


data: lo_conv    TYPE REF TO cl_abap_conv_in_ce,
      lv_decoded TYPE String,
      lv_encoded TYPE String.

lo_conv = cl_abap_conv_in_ce=>create( encoding = 'UTF-8'
                                      input    = iv_png ).

  CALL METHOD lo_conv->read
    IMPORTING
      data = lv_decoded.

  lv_encoded = cl_http_utility=>if_http_utility~encode_base64( lv_decoded ).

The first bytes of the PNG-File:

89504E470D0A1A0A0000000D49484452000002950000019E08020000004A1C6DAE00000001735247
4200AECE1CE90000000467414D410000B18F0BFC6105000000206348524D00007A26000080840000
FA00000080E8000075300000EA6000003A98000017709CBA513C0000000970485973000017110000
171101CA26F33F0000897149444154785EED9D79DC55531BF71F32A4148A2443938A32460351C990
2173320B8584CC32D3602ACA90428368120989CACC6328F39450A2323DAF31C4637ABCDFD7EF7DD6
673FE71E3AF7B9F7D9F7197EEB8FF3D97BEDB5D65EFB77D6BA7EEBBAD6B5D6FAC73F1C8C80113002
46C00818813C4560A38D36AA5FBFFE860E46C00818012360048C40AE220053C3D7FF33D278E69967
BEFCF2CB650E46C00818012360048C40AE22F0AF7FFD6BCE9C39FFC3DF0B172E5CBE7CF9370E46C0
0818012360048C40AE22F0C30F3FCC9F3FFF7FF87BC18205DF7EFBEDFF71300246C0081801236004
721581EFBEFBEEADB7DE327FE7EAFFE37A19012360048C8011280D01F3B7DB8511300246C0081881
FC43C0FC9D7FFF996B6C048C8011300246C0FCED3660048C801130024620FF10307FE7DF7FE61A1B
012360048C8011307FBB0D18012360048C8011C83F04CCDFF9F79FB9C646C0081801236004CCDF6E
0346C0081801236004F20F01F377FEFD67AEB111300246C0081801F3B7DB8011300246C0081881FC
43C0FC9D7FFF996B6C048C8011300246C0FCED3660048C801130024620FF10307FE7DF7FE61A1B01
2360048C8011307FBB0D18012360048C8011C83F04CCDFF9F79FB9C646C0081801236004CCDF6E03
46C0081801236004F20F81ACF0F7BFCA0D198014CAAB505E7245D367564885DEE8C446C008180123
60049241207EFE8626BFF9E69BFFFCE73F7F96167EFBEDB72FBEF8228559CBFFD42FBFFC925C84AF

The last bytes of the PNG-File:

300246C0081881A243C0FC5D747FB93FD80818012360040A0001F37701FC89FE042360048C801128
3A04CCDF45F797FB838D8011300246A00010307F17C09FE84F300246C0081881A243C0FC5D747FB9
3FD80818012360040A0001F37701FC89FE042360048C8011283A04CCDF45F797FB838D8011300246
A00010307F17C09FE84F300246C0081881A243C0FC5D747FB93FD80818012360040A0001F37701FC
89FE042360048C8011283A04CCDF45F797FB838D8011300246A00010307F17C09FE84F300246C008
1881A243A014FEFEE0830FBEFFFEFBAF1D8C8011300246C00818815C4560F9F2E5EFBCF3CE3FA2E1
B5D75E83D58B6E24E30F360246C008180123903F08A069BFF8E28BFFC3DFEDDAB5DB69A79DDA3B18
012360048C80113002B98A004CDDB66DDBFFE16FDF18012360048C801130027984C0FF053CBE0BC5
311913AD0000000049454E44AE426082

1 ACCEPTED SOLUTION
Read only

rainer_hbenthal
Active Contributor
0 Likes
923

Go to the repository information system (transaction SE80) and search for function modules. You will find a suitable one by searching fpr base64

4 REPLIES 4
Read only

rainer_hbenthal
Active Contributor
0 Likes
923

I can not see any reason to do this. A Xstring holds binary data, and a string holds text data. A PNG bytestreams is not a text and cannot be converted to utf-8. UTF8 is only for text.

What exactly do you want to achieve?

Read only

0 Likes
923

Hi,

I need to encode the string to BASE64 as I need to add it into a XHTML-File. For example Firefox is able to open embedded images which are Base64-encoded.

Regards,

Stefan

Read only

rainer_hbenthal
Active Contributor
0 Likes
924

Go to the repository information system (transaction SE80) and search for function modules. You will find a suitable one by searching fpr base64

Read only

0 Likes
923

Hi Rainer,

the FM "SSFC_BASE64_ENCODE" does what I need!

Many thanks and best regards,

Stefan