This commit is contained in:
512song committed 2025-07-03 22:19:02 +08:00
1 parent b58fc4376a
commit 321337fdda
6 files changed
+1101 -479

No files matched your search

+22 -4
View File
@@ -159,20 +159,38 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-02T03:09:22.716144Z",
"iopub.status.busy": "2025-07-02T03:09:22.715330Z",
"iopub.status.idle": "2025-07-02T03:09:22.722736Z",
"shell.execute_reply": "2025-07-02T03:09:22.721566Z",
"shell.execute_reply.started": "2025-07-02T03:09:22.716070Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bs b'\\xcd\\xf5\\xf0\\xa9\\xd1\\xf3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'\n",
"decode-bs: 王皓洋\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n",
"gbcode: b'\\xcd\\xf5\\xf0\\xa9\\xd1\\xf3'\n",
"gbs: cdf5f0a9d1f3\n"
]
}
],
"source": [
"import binascii\n",
"\n",
"gbs = 'D4C0CDAF'\n",
"gbs = 'CDF5F0A9D1F300000000000000000000'\n",
"bs = binascii.a2b_hex(gbs)\n",
"print('bs', bs)\n",
"print('decode-bs:', bs.decode('gbk'))\n",
"\n",
"s = '马立亚'\n",
"s = '王皓洋'\n",
"gbcode = s.encode('gbk') # 先转成 bytes格式\n",
"print('gbcode:', gbcode)\n",
"gbs = \"\".join([hex(ch)[2:] for ch in gbcode]) #\n",