- 发布:2024-07-03 14:25
- 更新:2024-12-12 17:58
- 阅读:644
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win11
HBuilderX类型: 正式
HBuilderX版本号: 4.22
手机系统: 全部
手机厂商: 华为
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
操作步骤:
如代码
如代码
预期结果:
如代码
如代码
实际结果:
报错
报错
bug描述:
function stringToBytes(str : string) : number[] {
let bytes : number[] = [];
for (let i = 0; i < str!.length; ++i) {
let charCode:Number = 0;
if (nfcAdapter !== null) {
charCode = str.charCodeAt(i);
}else{
return bytes;
}
// Push high and low bytes for non-BMP characters
if (charCode < 0x80) {
bytes.push(charCode);
} else if (charCode < 0x800) {
bytes.push(0xc0 | (charCode >> 6), 0x80 | (charCode & 0x3f));
} else if (charCode < 0xd800 || charCode >= 0xe000) {
bytes.push(
0xe0 | (charCode >> 12),
0x80 | ((charCode >> 6) & 0x3f),
0x80 | (charCode & 0x3f)
);
} else {
// Surrogate pairs
let nextCharCode = str?.charCodeAt(++i);
let codePoint = 0x10000 + ((charCode & 0x3ff) << 10) + (nextCharCode & 0x3ff);
bytes.push(
0xf0 | (codePoint >> 18),
0x80 | ((codePoint >> 12) & 0x3f),
0x80 | ((codePoint >> 6) & 0x3f),
0x80 | (codePoint & 0x3f)
);
}
}
return bytes;
}
coderH
兄弟 这个我太赞成你说的话了,就像本来是开航母的,他偏要说自己也可以飞自己就是航空母舰,结果呢摔得稀碎,什么语言就去干什么语言的事情,偏偏要想着一统江湖,UTS简直就是一桶浆糊
2025-01-20 16:25