We want to achieve the effect of sharing cards in wechat, but when there is Chinese in the address bar, it always fails and becomes a common sharing url.

Baidu after most is to say encode twice, the test has no effect. (But now I think it may be that our test environment was secretly modified, here is not table you can try)

Finally, a simple base64 method was used, successfully.

/** * Base64 encoding, support Chinese *@param value* /
    base64Encode(value) {
        let result;
        result = encodeURIComponent(value);
        result = unescape(result);
        result = window.btoa(result);
        return result;
    },

    /** * Base64 decoding, support Chinese *@param value* /
    base64Decode(value) {
        let result;
        result = window.atob(value);
        result = escape(result);
        result = decodeURIComponent(result);
        return result;
    },
Copy the code