sanex3339 9 年之前
父節點
當前提交
3c696f72da
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      dist/src/Utils.js
  2. 1 1
      src/Utils.ts

+ 1 - 1
dist/src/Utils.js

@@ -42,7 +42,7 @@ class Utils {
     }
     static stringToUnicode(string) {
         const radix = 16, unicodeSliceValue = -4;
-        let regexp = new RegExp('[a-zA-Z]');
+        let regexp = new RegExp('[\x00-\x7F]');
         return `'${string.replace(/[\s\S]/g, (escape) => {
             if (regexp.test(escape)) {
                 return '\\x' + escape.charCodeAt(0).toString(radix);

+ 1 - 1
src/Utils.ts

@@ -100,7 +100,7 @@ export class Utils {
         const radix: number = 16,
             unicodeSliceValue: number = -4;
 
-        let regexp: RegExp = new RegExp('[a-zA-Z]');
+        let regexp: RegExp = new RegExp('[\x00-\x7F]');
 
         return `'${string.replace(/[\s\S]/g, (escape: string): string => {
             if (regexp.test(escape)) {