<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic XML STRING TO XML UTF-8 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/12637498#M2013933</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have an xml string variable like that contains spcecial characteres like "ñ" i try to to convert to UTF-8 and save it but when I do that I cannot see the values of the XML. please see my example code:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA: lv_e_utf8                 TYPE xstring,
      lv_i_keep_trailing_blanks TYPE xfeld,
      lv_i_xml                  TYPE string,
      lv_other                  TYPE c.
&amp;lt;br&amp;gt;
  DATA: v_length TYPE i,
        v_base64 TYPE string. DATA: it_xml_tempo TYPE string       OCCURS 0 WITH HEADER LINE,
       it_temporal TYPE string OCCURS 0 WITH HEADER LINE.
lv_i_xml = '&amp;lt;inicio&amp;gt;&amp;lt;nombre&amp;gt;Luis Ñañamito&amp;lt;/nombre&amp;gt;&amp;lt;/inicio&amp;gt;'.
  DATA: lv_ruta TYPE string.
CONCATENATE 'c:/complemento/'
               'PRUEBA.xml' INTO lv_ruta.
  CLEAR: it_xml_tempo.  REFRESH: it_xml_tempo.  FREE: it_xml_tempo.  APPEND lv_i_xml TO it_xml_tempo.  DATA: V_UTF8 TYPE XSTRING.
  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      text           = lv_i_xml
*     MIMETYPE       = ' '
     ENCODING       = '4110'
   IMPORTING&amp;lt;br&amp;gt;
     BUFFER         = V_UTF8
            .
  IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
  ENDIF.

  APPEND  V_UTF8 TO it_temporal.
CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING&amp;lt;br&amp;gt;
      filename = lv_ruta
      filetype = 'ASC'
    TABLES&amp;lt;br&amp;gt;
      data_tab = it_temporal. "it_xml_tempo.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;When I save my field and open I only see:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2089469-xml-file.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;What I need to do to convert my xml file into UTF-8 format to d&lt;/P&gt;</description>
    <pubDate>Thu, 25 Aug 2022 14:30:06 GMT</pubDate>
    <dc:creator>luisrobertofrancomx</dc:creator>
    <dc:date>2022-08-25T14:30:06Z</dc:date>
    <item>
      <title>XML STRING TO XML UTF-8</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/12637498#M2013933</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have an xml string variable like that contains spcecial characteres like "ñ" i try to to convert to UTF-8 and save it but when I do that I cannot see the values of the XML. please see my example code:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA: lv_e_utf8                 TYPE xstring,
      lv_i_keep_trailing_blanks TYPE xfeld,
      lv_i_xml                  TYPE string,
      lv_other                  TYPE c.
&amp;lt;br&amp;gt;
  DATA: v_length TYPE i,
        v_base64 TYPE string. DATA: it_xml_tempo TYPE string       OCCURS 0 WITH HEADER LINE,
       it_temporal TYPE string OCCURS 0 WITH HEADER LINE.
lv_i_xml = '&amp;lt;inicio&amp;gt;&amp;lt;nombre&amp;gt;Luis Ñañamito&amp;lt;/nombre&amp;gt;&amp;lt;/inicio&amp;gt;'.
  DATA: lv_ruta TYPE string.
CONCATENATE 'c:/complemento/'
               'PRUEBA.xml' INTO lv_ruta.
  CLEAR: it_xml_tempo.  REFRESH: it_xml_tempo.  FREE: it_xml_tempo.  APPEND lv_i_xml TO it_xml_tempo.  DATA: V_UTF8 TYPE XSTRING.
  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      text           = lv_i_xml
*     MIMETYPE       = ' '
     ENCODING       = '4110'
   IMPORTING&amp;lt;br&amp;gt;
     BUFFER         = V_UTF8
            .
  IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
  ENDIF.

  APPEND  V_UTF8 TO it_temporal.
CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING&amp;lt;br&amp;gt;
      filename = lv_ruta
      filetype = 'ASC'
    TABLES&amp;lt;br&amp;gt;
      data_tab = it_temporal. "it_xml_tempo.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;When I save my field and open I only see:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2089469-xml-file.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;What I need to do to convert my xml file into UTF-8 format to d&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 14:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/12637498#M2013933</guid>
      <dc:creator>luisrobertofrancomx</dc:creator>
      <dc:date>2022-08-25T14:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: XML STRING TO XML UTF-8</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/12637499#M2013934</link>
      <description>&lt;P&gt;Function module GUI_DOWNLOAD is obsolete.&lt;/P&gt;&lt;P&gt;Replaced with method GUI_DOWNLOAD of CL_GUI_FRONTEND_SERVICES.&lt;/P&gt;&lt;P&gt;About the parameter FILETYPE, keep consistency, you should never mix characters with bytes, and bytes with characters (except when encoding/decoding):&lt;/P&gt;&lt;P&gt;XSTRING = bytes = BINary&lt;/P&gt;&lt;P&gt;STRING = characters = ASCii&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 15:25:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/12637499#M2013934</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-08-25T15:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: XML STRING TO XML UTF-8</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/13627565#M2026943</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/816122"&gt;@luisrobertofrancomx&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll appreciate you can share the solution you found, as we are facing same issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 22:56:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/xml-string-to-xml-utf-8/m-p/13627565#M2026943</guid>
      <dc:creator>Melina404</dc:creator>
      <dc:date>2024-03-04T22:56:32Z</dc:date>
    </item>
  </channel>
</rss>

