写了一个浏览字库的小程序,但是C2-DF库80-BF显示不正确,请帮忙查一下原因!
import console;var q = 0xB3;
console.setTitle("中文编码字符集");
for (z = 0x81; 0xFE; 1) {
if (q > 128 and q < 255) z = q;
var zz = string.format("%X", z);
console.writeColorText('\n\t\t\t 中文编码字符集', console.color.yellow, console.color.black);
console.writeColorText(' (GB18030-2022) ', console.color.red, console.color.black);
console.writeColorText(zz++'区', console.color.yellow, console.color.black);
console.log('\n');
console.writeColorText(' '++zz++' ', console.color.yellow, console.color.red);
for (j = 0x0; 0xF; 1) {
console.writeColorText(' ', console.color.yellow, console.color.black);
console.writeColorText(''++string.format("%0X", j) ++' ', console.color.red, console.color.yellow);
}
console.log('\n');
var k1 = "\x"++string.format("%X", z);
for (i = 0x4; 0xF; 1) {
console.writeColorText(''++string.format("%X", i) ++' ', console.color.red, console.color.yellow);
var kk = ' ';
for (j = 0x0; 0xF; 1) {
var k = i * 16 + j;
var k2 = "\x"++string.format("%X", k);
kk = kk++' '++string.format("%X", z) ++string.format("%X", k);
var k3 = k1++k2;
k3 = string.unhex(k3);
if ((i == 0x7 or i == 0xF) and j == 0xF) continue;
console.writeColorText('', console.color.yellow, console.color.black);
if (z >= 0xB0 and z <= 0xF7 and k > 0xA0) console.writeColorText(k3, console.color.white, console.color.black);
else console.writeColorText(k3, console.color.yellow, console.color.black);
console.writeColorText(' ');
}
console.log();
console.writeColorText(kk, 5, console.color.black);
console.log();
}
console.writeColorText('\n\t\t当前显示是 ', console.color.blue, console.color.black);
console.writeColorText(z, console.color.red, console.color.black);
console.writeColorText(' / ', console.color.blue, console.color.black);
console.writeColorText(zz, console.color.red, console.color.black);
console.writeColorText(' 区,', console.color.blue, console.color.black);
console.setTextAttribute(console.color.blue, console.color.black);
q = console.getNumber("请输入要显示的区号(129-254):");
console.clearScreen();
}
//在 aardio 中模拟 Python.exe 运行
import console;
import py3;
var pyCode = /*
import os
def hex_to_unicode(hex_string):
bytes_obj = bytes.fromhex(hex_string)
return bytes_obj.decode('GBK', errors='ignore')
q = 0xB3
for z in range( 0x81, 0xFE ):
os.system('cls' if os.name == 'nt' else 'clear')
if (q == 0): exit()
if (q > 128 and q < 255): z = q
zz = f'{z:X}'
print(f'\033[93m\n\t\t\t中文编码字符集\033[91m (GB18030-2022)\033[93m GBK字库')
print()
print(' \033[33m', zz, end=" ")
for j in range( 0x0, 0x10 ):
print(f'{j:X}' , end=" ")
print()
for i in range( 0x4, 0x10 ):
print(' \033[33m', f'{i:X}' , sep="", end=" ")
kk = ' '
for j in range( 0x0, 0x10 ):
k = i * 16 + j
k1 = f'{z:X}' + f'{k:X}'
k2 = hex_to_unicode(k1)
kk = kk+' '+ k1
if ((i == 0x7 or i == 0xF) and j == 0xF):continue
if (z >= 0xB0 and z <= 0xF7 and k > 0xA0): print('\033[93m', k2, end="")
else: print('\033[97m', k2, end="")
print()
print('\033[95;2m', kk, '\033[95;0m')
print('\033[94m\n 当前显示的字库是 \033[91m', z, '\033[94m / \033[91m', zz, '\033[94m 区。', sep="", end="")
try:
q = int(input( "请输入要显示的区号(129-254),输入 \033[91;5m0\033[0m\033[94m 退出:\033[91m"))
except ValueError:
if (z==0xB3): q = 0xBE
if (z==0xBE): q = 0xCE
if (z==0xCE): q = 0xB3
except KeyboardInterrupt:
q = 0
*/
console.setTitle("aardio-python");
py3.exec( pyCode ); 用python重新写的代码在arrdio中模拟运行还是不错的!:lol :):):):):):)
页:
[1]