Skip to content

replace btoa with UTF-8 Base64 to resolve i18n error dialog crashes - #1020

Open
SharpIceX wants to merge 1 commit into
tom5454:masterfrom
SharpIceX:fix/btoa-invalid-character
Open

replace btoa with UTF-8 Base64 to resolve i18n error dialog crashes#1020
SharpIceX wants to merge 1 commit into
tom5454:masterfrom
SharpIceX:fix/btoa-invalid-character

Conversation

@SharpIceX

Copy link
Copy Markdown
Contributor

fix:

Uncaught (in promise) InvalidCharacterError: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
    at Fac ((Plugin):cpm_plugin.js:2260:536)
    at d.Y3b ((Plugin):cpm_plugin.js:2015:60)
    at d ((Plugin):cpm_plugin.js:18:47)
Fac	@	(Plugin):cpm_plugin.js:2260
Y3b	@	(Plugin):cpm_plugin.js:2015
d	@	(Plugin):cpm_plugin.js:18
Promise.catch		
U3b	@	(Plugin):cpm_plugin.js:2013
d	@	(Plugin):cpm_plugin.js:18
(匿名)	@	file_system.ts:224
e	@	file_system.ts:166
i	@	file_system.ts:109
v3b	@	(Plugin):cpm_plugin.js:1998
F6b	@	(Plugin):cpm_plugin.js:2109
bac	@	(Plugin):cpm_plugin.js:2239
d	@	(Plugin):cpm_plugin.js:18
Ze	@	vue.min.js:11
B	@	vue.min.js:11
K6.G._wrapper	@	vue.min.js:11

As noted in the MDN Window.btoa() documentation, btoa() only supports ASCII and lacks built-in Unicode support. This causes errors when processing non-ASCII characters, including internationalized (i18n) text.

Before fix:

default.mp4

After fix:

default.mp4

…Unicode errors in localized CPM

Signed-off-by: SharpIce <VupRbl@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant