<?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>Question Re: Base64_encode and data types in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821566#M4852409</link>
    <description>&lt;P&gt;I agree on the doc topic. I have the impression that "strings" within the docs sometimes only refers to character strings and sometimes also includes binary strings, as here...&lt;/P&gt;
&lt;P&gt;That being said, the sample for BASE64_ENCODE seems to hint that "real binary data" should be passed as argument:&lt;/P&gt;
&lt;PRE&gt;SELECT BASE64_ENCODE( image_data ) FROM IMAGES;
&lt;/PRE&gt;

&lt;P&gt;FWIW, for non-ascii encodings, base64 is also required/helpful for "real character string" encoding, just to prevent problems with the  most significant bit, think of SMTP and the like...&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 11:22:34 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2020-06-10T11:22:34Z</dc:date>
    <item>
      <title>Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaq-p/13821564</link>
      <description>&lt;P&gt;The v16 &amp;amp; v17 documents (all versions including the SAP Help one) imply that the input to Base64_encode() should be a string - which seems to miss the whole point of the exercise &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; In fact it takes a long binary quite happily:
&lt;/P&gt;&lt;PRE&gt;create variable blah1 long binary;
create variable blah2 long varchar;
create variable blah3 long binary;
set blah1 = xp_read_file('c:\\tmp\\mark.tif');
set blah2 = base64_encode(blah1);
set blah3 = base64_decode(blah2);
call xp_write_file('c:\\tmp\\markOUT.tif',blah3 );
&lt;/PRE&gt;
with an 8MB tiff &lt;P&gt;&lt;/P&gt;
&lt;P&gt;I know that a related issue was discussed in &lt;A href="https://sqlanywhere-forum.sap.com/questions/22067" target="_blank"&gt;this question back in 2014&lt;/A&gt;. But it would avoid a lot of confusion if the documentation for the relevant functions could make it clear when they can handle binary data. (I've just spent some time explaining to someone that thye don't need to convert their binary data to a string so they can convert it to a string so that they .... you get the idea!)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 10:42:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaq-p/13821564</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2020-06-10T10:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821566#M4852409</link>
      <description>&lt;P&gt;I agree on the doc topic. I have the impression that "strings" within the docs sometimes only refers to character strings and sometimes also includes binary strings, as here...&lt;/P&gt;
&lt;P&gt;That being said, the sample for BASE64_ENCODE seems to hint that "real binary data" should be passed as argument:&lt;/P&gt;
&lt;PRE&gt;SELECT BASE64_ENCODE( image_data ) FROM IMAGES;
&lt;/PRE&gt;

&lt;P&gt;FWIW, for non-ascii encodings, base64 is also required/helpful for "real character string" encoding, just to prevent problems with the  most significant bit, think of SMTP and the like...&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 11:22:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821566#M4852409</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2020-06-10T11:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821565#M4852408</link>
      <description>&lt;P&gt;I've recommended an update to the docs to help make this more clear. The difficulty with many of these functions is that they accept arguments of all sorts of types and then convert the input argument to whatever seems to be the most appropriate for that type. &lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 12:47:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821565#M4852408</guid>
      <dc:creator>jack_schueler</dc:creator>
      <dc:date>2020-06-11T12:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821567#M4852410</link>
      <description>&lt;P&gt;Thanks - that's great. Just an indication not to get too hung up on the word "string" would do the job!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 13:49:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821567#M4852410</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2020-06-11T13:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821568#M4852411</link>
      <description>&lt;P&gt;FWIW the EXPRTYPE function is useful to answer the question "Just exactly what is the data type at this point?"&lt;/P&gt;
&lt;P&gt;For grins and giggles, check the return data type for &lt;A href="https://help.sap.com/viewer/93079d4ba8e44920ae63ffb4def91f5b/17.0/en-US/81fd93c36ce210148850c18def7680e6.html?q=string%20function"&gt;&lt;B&gt;the STRING() function&lt;/B&gt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 14:27:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821568#M4852411</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2020-06-11T14:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821569#M4852412</link>
      <description>&lt;P&gt;Yikes. That's the function that returns different things based on atmospheric pressure.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 15:08:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821569#M4852412</guid>
      <dc:creator>jack_schueler</dc:creator>
      <dc:date>2020-06-11T15:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Base64_encode and data types</title>
      <link>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821570#M4852413</link>
      <description>&lt;P&gt;&lt;IMG width="200" src="https://i.pinimg.com/originals/70/4b/cb/704bcbf28c74d375f782fd61617225ed.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 16:10:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/base64-encode-and-data-types/qaa-p/13821570#M4852413</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2020-06-11T16:10:52Z</dc:date>
    </item>
  </channel>
</rss>

