<?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: Issue with decoding Base 64 in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812041#M34747</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/419412"&gt;@SStrachan1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I presume that the value of&amp;nbsp;&lt;EM&gt;request.query&lt;/EM&gt;&amp;nbsp;is already encoded in base64. For me, as you're working with dynamical values&amp;nbsp;hubspot validator is displaying an error because is unable to know that &lt;EM&gt;request.query&lt;/EM&gt; contains encoded values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll do it in a different way. In your template, define the following variable:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;{% set decoded_url = encoded_url is none ? "" : encoded_url|b64decode %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your page, in the advanced section in the settings place the following declaration in the head rich_text:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;{% set encoded_url = request.query %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should solve your problem but it also could be a little forbidding if you have a lot of pages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice day!&lt;/P&gt;
&lt;P&gt;Matthieu&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2023 14:58:27 GMT</pubDate>
    <dc:creator>MBERARD</dc:creator>
    <dc:date>2023-06-26T14:58:27Z</dc:date>
    <item>
      <title>Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/811962#M34743</link>
      <description>&lt;P&gt;I am getting an error in Hubspot while trying to decode a URL. I get the feeling this is just an issue with the Hubsopt code validator.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set encoded_url = request.query %}
&amp;lt;h5&amp;gt;encoded: {{ encoded_url }}&amp;lt;/h5&amp;gt;

{% set decoded_url = encoded_url|b64decode %}
&amp;lt;h5&amp;gt;decoded: {{ decoded_url }}&amp;lt;/h5&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the decode part, I get the following error and can't publish the module.&lt;BR /&gt;"input byte array has wrong 4-byte ending unit"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The test below works which is essentially doing the same thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set myurl = 'yacht=485982377&amp;amp;status=charter&amp;amp;currency=USD&amp;amp;poa=no&amp;amp;vat_paid=no&amp;amp;broker=453230516&amp;amp;branded=yes&amp;amp;event=YACHT-SHOW' %}
{% set encoded_url = myurl|b64encode %} 
&amp;lt;h3&amp;gt;encoded: {{ encoded_url }}&amp;lt;/h3&amp;gt;

{% set decoded_url = encoded_url|b64decode %}
&amp;lt;h3&amp;gt;decoded: {{ decoded_url }}&amp;lt;/h3&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I need to be able to store the URL in a variable and decode it. Any ideas on what to do?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 13:23:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/811962#M34743</guid>
      <dc:creator>SStrachan1</dc:creator>
      <dc:date>2023-06-26T13:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812041#M34747</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/419412"&gt;@SStrachan1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I presume that the value of&amp;nbsp;&lt;EM&gt;request.query&lt;/EM&gt;&amp;nbsp;is already encoded in base64. For me, as you're working with dynamical values&amp;nbsp;hubspot validator is displaying an error because is unable to know that &lt;EM&gt;request.query&lt;/EM&gt; contains encoded values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll do it in a different way. In your template, define the following variable:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;{% set decoded_url = encoded_url is none ? "" : encoded_url|b64decode %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your page, in the advanced section in the settings place the following declaration in the head rich_text:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;{% set encoded_url = request.query %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should solve your problem but it also could be a little forbidding if you have a lot of pages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice day!&lt;/P&gt;
&lt;P&gt;Matthieu&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 14:58:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812041#M34747</guid>
      <dc:creator>MBERARD</dc:creator>
      <dc:date>2023-06-26T14:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812044#M34749</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/341938"&gt;@MBERARD&lt;/a&gt;&amp;nbsp;Thanks for the reply.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am still getting the same "input byte array has wrong 4-byte ending unit" error with this code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{% set decoded_url = encoded_url is none ? "" : encoded_url|b64decode %}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 15:05:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812044#M34749</guid>
      <dc:creator>SStrachan1</dc:creator>
      <dc:date>2023-06-26T15:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812048#M34750</link>
      <description>&lt;P&gt;Can you please pprint &lt;EM&gt;encoded_url&amp;nbsp;&lt;/EM&gt;and post the results?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 15:11:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812048#M34750</guid>
      <dc:creator>MBERARD</dc:creator>
      <dc:date>2023-06-26T15:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812050#M34751</link>
      <description>&lt;P&gt;Here you go.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(String: eWFjaHQ9NDg1OTgyMzc3JnN0YXR1cz1jaGFydGVyJmN1cnJlbmN5PVVTRCZwb2E9bm8mdmF0X3BhaWQ9bm8mYnJva2VyPTQ1MzIzMDUxNiZicmFuZGVkPXllcyZldmVudD1ZQUNIVC1TSE9X=)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I believe the = at the end is being added automatically.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 15:14:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812050#M34751</guid>
      <dc:creator>SStrachan1</dc:creator>
      <dc:date>2023-06-26T15:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812056#M34752</link>
      <description>&lt;P&gt;I think you find the problem. If you encode in base64 your query:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;yacht=485982377&amp;amp;status=charter&amp;amp;currency=USD&amp;amp;poa=no&amp;amp;vat_paid=no&amp;amp;broker=453230516&amp;amp;branded=yes&amp;amp;event=YACHT-SHOW&lt;/LI-CODE&gt;
&lt;P&gt;You get the following results:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;eWFjaHQ9NDg1OTgyMzc3JnN0YXR1cz1jaGFydGVyJmN1cnJlbmN5PVVTRCZwb2E9bm8mdmF0X3BhaWQ9bm8mYnJva2VyPTQ1MzIzMDUxNiZicmFuZGVkPXllcyZldmVudD1ZQUNIVC1TSE9X&lt;/LI-CODE&gt;
&lt;P&gt;So it's probably an interpretation of your browser as he consider the encoded query as a key instead of the whole value. You should probably update your URL with the following structure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;https://www.your-current-url.com/page?q=eWFjaHQ9NDg1OTgyMzc3JnN0YXR1cz1jaGFydGVyJmN1cnJlbmN5PVVTRCZwb2E9bm8mdmF0X3BhaWQ9bm8mYnJva2VyPTQ1MzIzMDUxNiZicmFuZGVkPXllcyZldmVudD1ZQUNIVC1TSE9X&lt;/LI-CODE&gt;
&lt;P&gt;Then update your code with the following declaration:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set encoded_url = request.query_dict.q %}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Jun 2023 15:36:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812056#M34752</guid>
      <dc:creator>MBERARD</dc:creator>
      <dc:date>2023-06-26T15:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with decoding Base 64</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812080#M34756</link>
      <description>&lt;P&gt;That did the trick. I had that earlier, but no this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set decoded_url = encoded_url is none ? "" : encoded_url|b64decode %}&lt;/LI-CODE&gt;&lt;P&gt;That is what was needed. Thank you for your halp!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 16:30:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-decoding-Base-64/m-p/812080#M34756</guid>
      <dc:creator>SStrachan1</dc:creator>
      <dc:date>2023-06-26T16:30:50Z</dc:date>
    </item>
  </channel>
</rss>

