SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

cl_abap_conv_in_ce



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
flex
Специалист
Специалист



Joined: 02 Feb 2011
Posts: 50

PostPosted: Thu Dec 01, 2011 3:49 pm    Post subject: cl_abap_conv_in_ce Reply with quote

Всем привет!

Вгружаю xml файл посредством инпута в bsp.

Преобразую xstring в string.

Code:
fileupload ?= cl_htmlb_manager=>get_data(
                       request = runtime->server->request
                       id      = 'myUpload'
                       name    = 'fileUpload' ).

file_name      = fileupload->file_name.
file_mime_type = fileupload->file_content_type.
file_length    = fileupload->file_length.
file_content   = fileupload->file_content.

* преобразуем content из xstring в string.
converted = cl_abap_conv_in_ce=>create( input = file_content ).
converted->read( IMPORTING data = content_new ).


Не могу понять, как правильно работать с кодировкой. Русский текст преобразуется в кракозябру.

Вопрос: как правильно отобразить русский текст?
Embarassed

UPD1
Посмотрел кодировку xml файла, увидел там WINDOWS-1251

Попробовал указать параметр encoding при создании
Code:
converted = cl_abap_conv_in_ce=>create( input = file_content encoding = 'WINDOWS-1251' ).


Вывалило ошибку...



1.png
 Description:
 Filesize:  21.38 KB
 Viewed:  6812 Time(s)

1.png


Back to top
View user's profile Send private message
flex
Специалист
Специалист



Joined: 02 Feb 2011
Posts: 50

PostPosted: Thu Dec 01, 2011 4:27 pm    Post subject: Reply with quote

UPD2

Прошерстил инет, сделал так:
Code:
converted = cl_abap_conv_in_ce=>create(
                  input = file_content encoding = '1504'
                  ignore_cerr = abap_true ).


Это сработало, теперь кириллический текст отображается.

НО! каким образом? я не понимаю... В некоторых местах текста произошла транслитерация. как?



2.png
 Description:
 Filesize:  9.69 KB
 Viewed:  6806 Time(s)

2.png


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.