<?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 Re: Replacing hex characters problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188552#M1624947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;used FM 'SCP_REPLACE_STRANGE_CHARS'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Aug 2011 18:35:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-08-30T18:35:28Z</dc:date>
    <item>
      <title>Replacing hex characters problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188549#M1624944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a text box where users can paste text into. When processing I notice a bunch of special characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To remove them, I am converting to Hex using&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  
CALL METHOD cl_abap_codepage=&amp;gt;convert_to
    EXPORTING
      source      = iv_text
      codepage    = `UTF-8`
      replacement = ''
      ignore_cerr = abap_false
    RECEIVING
      result      = buffer.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I replace the special character posing as an apostrophe with the hex equivalant of an apostrophe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA:lv_old_ap TYPE x VALUE '99',
            lv_new_ap TYPE x VALUE '27',
  
  REPLACE ALL OCCURRENCES OF lv_old_ap IN buffer WITH lv_new_ap IN BYTE MODE .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then convert it back to a string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL METHOD cl_abap_codepage=&amp;gt;convert_from
    EXPORTING
      source      = buffer
      codepage    = `UTF-8`
      replacement = ''
      ignore_cerr = abap_true
    RECEIVING
      result      = iv_text.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, for some reason it's also inserting two spaces when converting the apostrophe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input text:&lt;/P&gt;&lt;P&gt;u201CI donu2019t have any skulls and crossbones on me.u201D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output text:&lt;/P&gt;&lt;P&gt;u201CI don  't have any skulls and crossbones on me.u201D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea why it's inserting two spaces?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 18:05:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188549#M1624944</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-30T18:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing hex characters problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188550#M1624945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could you provide us with the original hex value of iv_text please? (for the text you mentioned, &lt;STRONG&gt;do it with the debugger&lt;/STRONG&gt; )&lt;/P&gt;&lt;P&gt;I would like to make sure about the original encoding (because 99 doesn't correspond to an apostrophe, so it is probably accompanied with something else)&lt;/P&gt;&lt;P&gt;Moreover, do you have a Unicode system?&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;&lt;P&gt;Sandra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 18:25:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188550#M1624945</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2011-08-30T18:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing hex characters problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188551#M1624946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes, we have a unicode system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just solved the issue by running the text through FM 'SCP_REPLACE_STRANGE_CHARS' instead of messing around with the hex replacement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 18:35:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188551#M1624946</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-30T18:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing hex characters problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188552#M1624947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;used FM 'SCP_REPLACE_STRANGE_CHARS'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 18:35:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188552#M1624947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-30T18:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing hex characters problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188553#M1624948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know the Hex value then use the below class to get the special char..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CL_ABAP_CONV_IN_CE =&amp;gt;UCCP&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;  uccp = '00A0'  " Hex value&lt;/P&gt;&lt;P&gt;receiving &lt;/P&gt;&lt;P&gt;char = buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your replace statement need to change. like below&lt;/P&gt;&lt;P&gt; REPLACE ALL OCCURRENCES OF &lt;STRONG&gt;buffer&lt;/STRONG&gt; IN  &lt;STRONG&gt;lv_old_ap&lt;/STRONG&gt;  WITH lv_new_ap IN BYTE MODE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Subhankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2011 22:01:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188553#M1624948</guid>
      <dc:creator>Subhankar</dc:creator>
      <dc:date>2011-08-30T22:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing hex characters problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188554#M1624949</link>
      <description>&lt;P&gt;Thank you very much. It solved the problem I had in Longtext.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 14:16:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-hex-characters-problem/m-p/8188554#M1624949</guid>
      <dc:creator>fabriciocaete</dc:creator>
      <dc:date>2023-10-05T14:16:11Z</dc:date>
    </item>
  </channel>
</rss>

