We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function stringToUtf8(string) { let encoder = new TextEncoder(); return encoder.encode(string); }
用这个替换 toUtf8Bytes 方法我试了下也没有问题,是出于什么原因必须要自己实现这个方法呢?
The text was updated successfully, but these errors were encountered:
你说的对,只是我当时写的时候没想到,现在也懒得改了,哈哈哈 ◕‿◕
Sorry, something went wrong.
我因为传的参数有点多,就说一堆数组的坐标值,会导致fixed maximum call stack size exceeded 就改成了使用TextEncoder对象来处理字符串的buffer,不使用for或...语法,使用TypedArray.prototype.set来减少遍历问题
但是真机测试存在问题!小程序本身不能使用
能举个例子不,传了多少参数,小程序的TextEncoder网上应该有解决方案的。你可以把这里的utf8转换方式拿过来试试看https://developer.mozilla.org/zh-CN/docs/Glossary/Base64
因为TextEncoder不稳定,接口上没有明确,之前好像开放出来,后来又不行了。
我出现fixed maximum call stack size exceeded应该是convert转换时造成的,有一个数组的字符串,数组里面的又是数组,每个坐标值。在text to buffer 之前就出现了问题。我切换了思路,使用TypedArray接口来复制数据,避免了这个问题。
No branches or pull requests
用这个替换 toUtf8Bytes 方法我试了下也没有问题,是出于什么原因必须要自己实现这个方法呢?
The text was updated successfully, but these errors were encountered: