Base64解码异常,有谁知道怎么解决吗?

let base64 = new util.Base64Helper();base64.decodeSync(“3dJN+3PyTrVerM7l2xZJawpLHv3U+0ErybhFNNCVBKgTYTd8baEKuvSbf4mvL+KqS0Vp2Kl1wVmBgMUOnhJ1tCXLM+uEkGwHWrCy2EatBu1VA+Ki2Ec/QCE3IKtygdKvuwONbGrB84OA+Urv31JaN6v5+88QDzN5eH8C7y5/MWNGXe9UnEZZvgAmIjtysH7np8yXXCQKyYnJrsvrNGmuoSdDldt69NS9IcgNENY2zYON7cuB1utGfagXLi7w1mv79sLQ61WfM+kXIPp5MwyCANP4V/l/9u3MohNcHH7vlkPg++FiEVM/w/msLxwSLoqLbJolg5YOhCSCU3y2LrPhazCIZERsN0nUZEpp5gfslCR+6L86NF0TUMZSLaYAkXBdD2musztX7vAn1EI2Tvic/yaN3b7AOvQowWHL90bHjOSOGz5HopwjwuXLNsOY6AJ9MHlopAGQENZRHg7sjN+ZI7qVdk8MyWemanMembsPgc0wZ3WbNTz2vlubtXyGaM2MKUcUvEmG8MSPDWLlnVBEeu81DAcKXLo3P4RVjUbAg52VLt/ownClYvkF5iTqqAfTwzHaZtgSDA5oE+r0GBY3t3neFElegEKlJpCwRS8mw85skck3+TxsO9fTWkcF3NREie1st578U9nJn5pYagVduQ+dVf6TXY9jKwcycV7dbtv1oBvXRN11gCX6aDS+MQQqxKotC/t+Cu3ui3nkHtLx+yHP4iRNL9qSocVJD4jEv6H8UM/fBXKMRrOwhDJx9+mNMuDBNrfeyr8bwmBmUT03XxWN9kx2XhBg640A7aQYjEN2oUCjo2qH5sbUyKsGVwaQNsViVFYfCIvEucbpa4B4W047u8O2bleItGjQEQTAS8a3q7C/UGDmH/frL/Re0yu5jtVRVgDPqgVbCzyMQ4bHtdRlFPISDBkudq7B5So9BIYkCSkRfeSWhwmPQ/WX/C8Bco/UO2/2XLcYQ7ilvFbQovqTSZlb0HV70g9LIrVs90/7uS1zaq3CBGo7GA+FikfHnD06MrFGDAOFiB9j8uRw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j10S5IeNJlvaM750MvzZItvsSQcR1QcNzqq3XuHveVafmycHbV2eFnFxFc+3/2+hOQSS2s662N4/ONQ==”); 

报错如下:

[nodict][ecmascript] Pending exception before IsMixedDebugEnabled called in line:3200, exception details as follows:[nodict]Error: The input string contains unsupported characters[nodict] at decodeSync (/usr1/hmos_for_system/src/increment/sourcecode/out/generic_generic_arm_64only/hisi_all_phone_standard/obj/commonlibrary/ets_utils/js_util_module/util/util_js.js:69:69)[nodict] at parseClientConfig (oh_modules/.ohpm/AliyunLivenessVerify@sfloeeate7fnhqjieeqstn9bsm8=/oh_modules/AliyunLivenessVerify/src/main/ets/a/q/e7.js:1:1651)[nodict] at verify (oh_modules/.ohpm/AliyunLivenessVerify@sfloeeate7fnhqjieeqstn9bsm8=/oh_modules/AliyunLivenessVerify/src/main/ets/a/b/e.js:1:1845)[nodict] at anonymous (demo/src/main/ets/demo/pages/DemoIndex.ets:185:25)[nodict] at anonymous (demo/src/main/ets/demo/network/DemoNetworkRequest.ets:56:33)
HarmonyOS
2024-04-27 23:58:47
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
e_leaner
// 字符串转成字节流 
function stringToUint8Array(str: string) { 
  return new Uint8Array(buffer.from(str, 'utf-8').buffer); 
} 
 
// 字节流转成可理解的字符串 
function uint8ArrayToString(array: Uint8Array): string { 
  // 将UTF-8编码转换成Unicode编码 
  let out: string = ""; 
  let index: number = 0; 
  let len: number = array.length; 
  while (index < len) { 
    let character = array[index++]; 
    switch (character >> 4) { 
      case 0: 
      case 1: 
      case 2: 
      case 3: 
      case 4: 
      case 5: 
      case 6: 
      case 7: 
        out += String.fromCharCode(character); 
        break; 
      case 12: 
      case 13: 
        out += String.fromCharCode(((character & 0x1F) << 6) | (array[index++] & 0x3F)); 
        break; 
      case 14: 
        out += String.fromCharCode(((character & 0x0F) << 12) | ((array[index++] & 0x3F) << 6) | ((array[index++] & 0x3F) << 0)); 
        break; 
      default: 
        break; 
    } 
  } 
  return out; 
} 
 
function doDecryption(encodeString: string) { 
  let base64_ = new util.Base64Helper(); 
  let decodeArr: Uint8Array = base64_.decodeSync(encodeString); 
  let decodeStr = uint8ArrayToString(decodeArr); 
 
  log.info('doEncrypted, decodeArr: ' + decodeArr); 
  log.info('doEncrypted, decodeStr: ' + decodeStr); 
}
分享
微博
QQ
微信
回复
2024-04-28 21:17:52
相关问题
HarmonyOS base64解码报错
685浏览 • 1回复 待解决
有谁知道沙箱目录怎么获取
2227浏览 • 1回复 待解决
JSVM使用示例,有谁知道
954浏览 • 1回复 待解决
有谁知道ArkTS支持定时器
2586浏览 • 1回复 待解决
有谁知道ArkTS支持隐式跳转
1719浏览 • 1回复 待解决
动态页面跳转方案,有谁知道
1755浏览 • 1回复 待解决
有谁知道flexBasis使用问题
767浏览 • 1回复 待解决
有谁知道如何创建 JSONObject
288浏览 • 1回复 待解决
有谁知道如何生成UUID
1534浏览 • 1回复 待解决
设备唯一ID,有谁知道怎么处理?
1976浏览 • 1回复 待解决
有谁知道可以直接使用so库
972浏览 • 1回复 待解决
如何进行base64编码,有人知道
579浏览 • 1回复 待解决
有谁知道怎么解决啊?
1535浏览 • 1回复 待解决
同进程多Hap问题 ,有谁知道
1360浏览 • 1回复 待解决
有谁知道如何主动关闭应用
1797浏览 • 1回复 待解决
有谁知道Image图片取反色
2005浏览 • 1回复 待解决
有谁知道应用升级的方式
1616浏览 • 1回复 待解决