Jump to content

The unicode in urls and btoa() problem usage for v4.7.16


Go to solution Solved by Stuart Silvester,

Recommended Posts

Posted (edited)

After upgrade we've noticed the new btoa() function and error "failed to execute btoa()" in global_global_core.js
As a result, pagination for cyrillic urls stopped working. 
See https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem

As a temporary solution we implemented the convertion between UTF-8 and single-byte representations before call btoa(), like

Quote

    const toBinaryStr = url => {
        const encoder = new TextEncoder();
        const charCodes = encoder.encode(url);
        const binString = Array.from(charCodes, (byte) => String.fromCodePoint(byte), ).join("");
        return binString;
    };
   <...>
    this._stateKey = `table${btoa(toBinaryStr(this.scope.attr('data-baseurl') ? ips.utils.url.pageParamToPath(this._cleanUpURL(this.scope.attr('data-baseurl')), this._pageParam, 1) : ''))}`;

Edited by Tikhonov Ivan
Posted

Would you, please, fix this core bug of global_global_core.js soon?
It is inconvenient to apply above custom patch every time after clearing system caches. I believe every forums with non-Latin topic urls are affected.

Posted
16 minutes ago, Jim M said:

Please ensure that you have applied the latest release and all patches. I have tagged a developer to review what you have posted though.

Thanks, Jim. That's the point of latest release as well, compared with v4.7.15 the btoa() function appeared in core java-script and utf-8 character string is unacceptable as a btoa() argument.

Posted

We're going to address this in a patch (likely tomorrow) with some other items but in the meantime you can go to AdminCP > Search Engine Optimisation > enable Rewrite FURLs (and follow the instructions). This will work around the issue since it's only a problem when FURLS are not used.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...