Making WordPress.org

Changeset 6842


Ignore:
Timestamp:
03/08/2018 05:28:52 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Escape readme data before encoding so that Unicode characters could be encoded correctly.

Props alpipego.
Fixes #3497.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-readme-validator.php

    r6647 r6842  
    4141                    var readmeInputs = document.getElementsByTagName( 'textarea' );
    4242
    43                     readmeInputs[1].value = window.btoa( readmeInputs[0].value );
     43                    readmeInputs[1].value = window.btoa( encodeURIComponent( readmeInputs[0].value ).replace( /%([0-9A-F]{2})/g,
     44                        function toSolidBytes( match, p1 ) {
     45                            return String.fromCharCode( '0x' + p1 );
     46                        })
     47                    );
    4448
    4549                    return true;
Note: See TracChangeset for help on using the changeset viewer.