<?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: Convert String to base64 in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311547#M82576</link>
    <description>&lt;P&gt;Tried this today, but it doesn't seem to work. The source are files in sql strored as binary, and after migrating to SF the files are corrupt and cannot be open.  In the SQL metadata, I have setup the column where the data is as a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subjob:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000F7WG0AAN.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149742i99C1E02D5FABE206/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000F7WG0AAN.png" alt="0695b00000F7WG0AAN.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my tJavarow Basic:&lt;/P&gt;&lt;P&gt;output_row.Owner_Id = input_row.Owner_Id;&lt;/P&gt;&lt;P&gt;output_row.Client_Id = input_row.Client_Id;&lt;/P&gt;&lt;P&gt;output_row.Contact_Number = input_row.Contact_Number;&lt;/P&gt;&lt;P&gt;output_row.Record_Id = input_row.Record_Id;&lt;/P&gt;&lt;P&gt;output_row.Description = input_row.Description;&lt;/P&gt;&lt;P&gt;output_row.Ole_Doc_Type = input_row.Ole_Doc_Type;&lt;/P&gt;&lt;P&gt;byte[] b = row3.TextCol.getBytes();&lt;/P&gt;&lt;P&gt;String s = new sun.misc.BASE64Encoder().encode(b);&amp;nbsp;&lt;/P&gt;&lt;P&gt;row4.TextCol = s;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tJavaRow Advance:&lt;/P&gt;&lt;P&gt;import org.apache.commons.codec.binary.Base64;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tmap:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000F7WILAA3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139300i4C007ACE2CB6139C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000F7WILAA3.png" alt="0695b00000F7WILAA3.png" /&gt;&lt;/span&gt;Help would be appreciated, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 May 2021 20:54:18 GMT</pubDate>
    <dc:creator>JSey</dc:creator>
    <dc:date>2021-05-18T20:54:18Z</dc:date>
    <item>
      <title>Convert String to base64</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311544#M82573</link>
      <description>&lt;P&gt;Hi. Im kind of newbie in all these things and definitely cannot code, so please be patient with me &lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; In our Salesforce org we have custom Note field (String) on Account object. There is a new Notes feature (introduced few releases back), information is stored in ContentNote object, in the Content field, which is base64 type. Im trying to migrate old Notes in new Notes. Im facing the problem to convert the data from String to base64. I found the article where was recommended to use tJava component with following code:&lt;/P&gt; 
&lt;PRE&gt;String s = new sun.misc.BASE64Encoder().encode(out.Content);
            //System.out.println("Text Decryted : " + s);
            row4.Content = s;&lt;/PRE&gt; 
&lt;P&gt;I tried this but unfortunately it doesnt work, I received an error saying:&amp;nbsp;&lt;/P&gt; 
&lt;P class="p1"&gt;&lt;FONT color="#FF0000"&gt;Error in the component's properties:The method encode(byte[]) in the type CharacterEncoder is not applicable for the arguments (String)&lt;/FONT&gt;&lt;/P&gt; 
&lt;P class="p1"&gt;&lt;FONT color="#000000"&gt;Can anyone please help? See attached pictures. For this moment Im just trying to create records in new Notes, I will relate them to Accounts in next step. Many thanks for help&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tJava Component.png" style="width: 998px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lv6m.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141889i4C148A73D031D2F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lv6m.png" alt="0683p000009Lv6m.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tMap.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lv4C.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154989i1530419BA629DF03/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lv4C.png" alt="0683p000009Lv4C.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Design.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Luy0.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144607iD47FDE894F199E72/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Luy0.png" alt="0683p000009Luy0.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 18:27:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311544#M82573</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-04T18:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to base64</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311545#M82574</link>
      <description>&lt;P&gt;I think you need to convert String to bytes array before to encode.&lt;/P&gt;
&lt;P&gt;Here is a example from StackExchange for the conversion:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="typ"&gt;String&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; example &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"Convert Java String"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="kwd"&gt;byte&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; bytes &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; example&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;getBytes&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;();&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;You need to put this in the tJava (or tJavaRow) and pass the result to BASE64Encoder.&lt;/P&gt;
&lt;P&gt;Something like that:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="kwd"&gt;byte&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[]&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; b &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; out.Content&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;getBytes&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;();&lt;BR /&gt;String s = new sun.misc.BASE64Encoder().encode(b); &lt;BR /&gt;row4.Content = s;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;If it doesn't&amp;nbsp;solve your problem,&amp;nbsp;let us know.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 19:28:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311545#M82574</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-07-04T19:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to base64</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311546#M82575</link>
      <description>As per above. Use the String getBytes() function. Also, use tJavaRow instead of tJava since you are in a flow.</description>
      <pubDate>Tue, 04 Jul 2017 20:53:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311546#M82575</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-04T20:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to base64</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311547#M82576</link>
      <description>&lt;P&gt;Tried this today, but it doesn't seem to work. The source are files in sql strored as binary, and after migrating to SF the files are corrupt and cannot be open.  In the SQL metadata, I have setup the column where the data is as a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subjob:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000F7WG0AAN.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149742i99C1E02D5FABE206/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000F7WG0AAN.png" alt="0695b00000F7WG0AAN.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my tJavarow Basic:&lt;/P&gt;&lt;P&gt;output_row.Owner_Id = input_row.Owner_Id;&lt;/P&gt;&lt;P&gt;output_row.Client_Id = input_row.Client_Id;&lt;/P&gt;&lt;P&gt;output_row.Contact_Number = input_row.Contact_Number;&lt;/P&gt;&lt;P&gt;output_row.Record_Id = input_row.Record_Id;&lt;/P&gt;&lt;P&gt;output_row.Description = input_row.Description;&lt;/P&gt;&lt;P&gt;output_row.Ole_Doc_Type = input_row.Ole_Doc_Type;&lt;/P&gt;&lt;P&gt;byte[] b = row3.TextCol.getBytes();&lt;/P&gt;&lt;P&gt;String s = new sun.misc.BASE64Encoder().encode(b);&amp;nbsp;&lt;/P&gt;&lt;P&gt;row4.TextCol = s;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tJavaRow Advance:&lt;/P&gt;&lt;P&gt;import org.apache.commons.codec.binary.Base64;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tmap:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000F7WILAA3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139300i4C007ACE2CB6139C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000F7WILAA3.png" alt="0695b00000F7WILAA3.png" /&gt;&lt;/span&gt;Help would be appreciated, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 20:54:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-String-to-base64/m-p/2311547#M82576</guid>
      <dc:creator>JSey</dc:creator>
      <dc:date>2021-05-18T20:54:18Z</dc:date>
    </item>
  </channel>
</rss>

