中文被 json_encode 編碼成 unicode 之後如何轉換回中文

xiaozhou113543096發表於2020-12-23

使用 php 自帶的 json_encode 函式對資料進行編碼時,中文都會變成 unicode,前面我介紹瞭如何使得中文不被 json_encode 不編碼成 unicode。

如果已經被 json_encode 編碼成 unicode 之後,怎麼轉換回中文呢?可以使用下面該函式將 unicode 進行轉換:

function wpjam_unicode_decode(KaTeX parse error: Expected '}', got 'EOF' at end of input: …)/i', function(matches){
return mb_convert_encoding(pack(“H*”, $matches[1]), ‘UTF-8’, ‘UCS-2BE’);
}, $str);
}
該功能已經整合到 WPJAM Basic 外掛中,並已免費提供下載!

https://github.com/users/fghdfghdfg5/projects/1088
https://github.com/users/fghdfghdfg5/projects/1089
https://github.com/users/fghdfghdfg5/projects/1090
https://github.com/users/fghdfghdfg5/projects/1091
https://github.com/users/fghdfghdfg5/projects/1092
https://github.com/users/fghdfghdfg5/projects/1093
https://github.com/users/fghdfghdfg5/projects/1094
https://github.com/users/fghdfghdfg5/projects/1095
https://github.com/users/fghdfghdfg5/projects/1096
https://github.com/users/fghdfghdfg5/projects/1097
https://github.com/users/fghdfghdfg5/projects/1098
https://github.com/users/fghdfghdfg5/projects/1099
https://github.com/users/fghdfghdfg5/projects/1100
https://github.com/users/fghdfghdfg5/projects/1101
https://github.com/users/fghdfghdfg5/projects/1102
https://github.com/users/fghdfghdfg5/projects/1103
https://github.com/users/fghdfghdfg5/projects/1104
https://github.com/users/fghdfghdfg5/projects/1105
https://github.com/users/fghdfghdfg5/projects/1106
https://github.com/users/fghdfghdfg5/projects/1107
https://github.com/users/fghdfghdfg5/projects/1108
https://github.com/users/fghdfghdfg5/projects/1109
https://github.com/users/fghdfghdfg5/projects/1110
https://github.com/users/fghdfghdfg5/projects/1111
https://github.com/users/fghdfghdfg5/projects/1112
https://github.com/users/fghdfghdfg5/projects/1113
https://github.com/users/fghdfghdfg5/projects/1114
https://github.com/users/fghdfghdfg5/projects/1115
https://github.com/users/fghdfghdfg5/projects/1116
https://github.com/users/fghdfghdfg5/projects/1117
https://github.com/users/fghdfghdfg5/projects/1118
https://github.com/users/fghdfghdfg5/projects/1119
https://github.com/users/fghdfghdfg5/projects/1120
https://github.com/users/fghdfghdfg5/projects/1121
https://github.com/users/fghdfghdfg5/projects/1122
https://github.com/users/fghdfghdfg5/projects/1123
https://github.com/users/fghdfghdfg5/projects/1124
https://github.com/users/fghdfghdfg5/projects/1125
https://github.com/users/fghdfghdfg5/projects/1126
https://github.com/users/fghdfghdfg5/projects/1127
https://github.com/users/fghdfghdfg5/projects/1128
https://github.com/users/fghdfghdfg5/projects/1129
https://github.com/users/fghdfghdfg5/projects/1130
https://github.com/users/fghdfghdfg5/projects/1131
https://github.com/users/fghdfghdfg5/projects/1132
https://github.com/users/fghdfghdfg5/projects/1133
https://github.com/users/fghdfghdfg5/projects/1134
https://github.com/users/fghdfghdfg5/projects/1135
https://github.com/users/fghdfghdfg5/projects/1136
https://github.com/users/fghdfghdfg5/projects/1137
https://github.com/users/fghdfghdfg5/projects/1138
https://github.com/users/fghdfghdfg5/projects/1139
https://github.com/users/fghdfghdfg5/projects/1140
https://github.com/users/fghdfghdfg5/projects/1141
https://github.com/users/fghdfghdfg5/projects/1142
https://github.com/users/fghdfghdfg5/projects/1143
https://github.com/users/fghdfghdfg5/projects/1144
https://github.com/users/fghdfghdfg5/projects/1145
https://github.com/users/fghdfghdfg5/projects/1146
https://github.com/users/fghdfghdfg5/projects/1147
https://github.com/users/fghdfghdfg5/projects/1148
https://github.com/users/fghdfghdfg5/projects/1149
https://github.com/users/fghdfghdfg5/projects/1150
https://github.com/users/fghdfghdfg5/projects/1151
https://github.com/users/fghdfghdfg5/projects/1152
https://github.com/users/fghdfghdfg5/projects/1153
https://github.com/users/fghdfghdfg5/projects/1154
https://github.com/users/fghdfghdfg5/projects/1155
https://github.com/users/fghdfghdfg5/projects/1156
https://github.com/users/fghdfghdfg5/projects/1157
https://github.com/users/fghdfghdfg5/projects/1158
https://github.com/users/fghdfghdfg5/projects/1159
https://github.com/users/fghdfghdfg5/projects/1160
https://github.com/users/fghdfghdfg5/projects/1161
https://github.com/users/fghdfghdfg5/projects/1162
https://github.com/users/fghdfghdfg5/projects/1163
https://github.com/users/fghdfghdfg5/projects/1164
https://github.com/users/fghdfghdfg5/projects/1165
https://github.com/users/fghdfghdfg5/projects/1166
https://github.com/users/fghdfghdfg5/projects/1167
https://github.com/users/fghdfghdfg5/projects/1168
https://github.com/users/fghdfghdfg5/projects/1169
https://github.com/users/fghdfghdfg5/projects/1170
https://github.com/users/fghdfghdfg5/projects/1171
https://github.com/users/fghdfghdfg5/projects/1172
https://github.com/users/fghdfghdfg5/projects/1173
https://github.com/users/fghdfghdfg5/projects/1174
https://github.com/users/fghdfghdfg5/projects/1175
https://github.com/users/fghdfghdfg5/projects/1176
https://github.com/users/fghdfghdfg5/projects/1177
https://github.com/users/fghdfghdfg5/projects/1178
https://github.com/users/fghdfghdfg5/projects/1179
https://github.com/users/fghdfghdfg5/projects/1180
https://github.com/users/fghdfghdfg5/projects/1181
https://github.com/users/fghdfghdfg5/projects/1182
https://github.com/users/fghdfghdfg5/projects/1183
https://github.com/users/fghdfghdfg5/projects/1184
https://github.com/users/fghdfghdfg5/projects/1185
https://github.com/users/fghdfghdfg5/projects/1186
https://github.com/users/fghdfghdfg5/projects/1187
https://github.com/users/fghdfghdfg5/projects/1188
https://github.com/users/fghdfghdfg5/projects/1189
https://github.com/users/fghdfghdfg5/projects/1190
https://github.com/users/fghdfghdfg5/projects/1191
https://github.com/users/fghdfghdfg5/projects/1192
https://github.com/users/fghdfghdfg5/projects/1193
https://github.com/users/fghdfghdfg5/projects/1194
https://github.com/users/fghdfghdfg5/projects/1195
https://github.com/users/fghdfghdfg5/projects/1196
https://github.com/users/fghdfghdfg5/projects/1197
https://github.com/users/fghdfghdfg5/projects/1198
https://github.com/users/fghdfghdfg5/projects/1199
https://github.com/users/fghdfghdfg5/projects/1200
https://github.com/users/fghdfghdfg5/projects/1201
https://github.com/users/fghdfghdfg5/projects/1202
https://github.com/users/fghdfghdfg5/projects/1203
https://github.com/users/fghdfghdfg5/projects/1204
https://github.com/users/fghdfghdfg5/projects/1205
https://github.com/users/fghdfghdfg5/projects/1206
https://github.com/users/fghdfghdfg5/projects/1207
https://github.com/users/fghdfghdfg5/projects/1208
https://github.com/users/fghdfghdfg5/projects/1209
https://github.com/users/fghdfghdfg5/projects/1210
https://github.com/users/fghdfghdfg5/projects/1211
https://github.com/users/fghdfghdfg5/projects/1212
https://github.com/users/fghdfghdfg5/projects/1213
https://github.com/users/fghdfghdfg5/projects/1214
https://github.com/users/fghdfghdfg5/projects/1215
https://github.com/users/fghdfghdfg5/projects/1216
https://github.com/users/fghdfghdfg5/projects/1217
https://github.com/users/fghdfghdfg5/projects/1218
https://github.com/users/fghdfghdfg5/projects/1219
https://github.com/users/fghdfghdfg5/projects/1220
https://github.com/users/fghdfghdfg5/projects/1221
https://github.com/users/fghdfghdfg5/projects/1222
https://github.com/users/fghdfghdfg5/projects/1223
https://github.com/users/fghdfghdfg5/projects/1224
https://github.com/users/fghdfghdfg5/projects/1225
https://github.com/users/fghdfghdfg5/projects/1226
https://github.com/users/fghdfghdfg5/projects/1227
https://github.com/users/fghdfghdfg5/projects/1228
https://github.com/users/fghdfghdfg5/projects/1229
https://github.com/users/fghdfghdfg5/projects/1230
https://github.com/users/fghdfghdfg5/projects/1231
https://github.com/users/fghdfghdfg5/projects/1232
https://github.com/users/fghdfghdfg5/projects/1233
https://github.com/users/fghdfghdfg5/projects/1234
https://github.com/users/fghdfghdfg5/projects/1235
https://github.com/users/fghdfghdfg5/projects/1236
https://github.com/users/fghdfghdfg5/projects/1237
https://github.com/users/fghdfghdfg5/projects/1238
https://github.com/users/fghdfghdfg5/projects/1239
https://github.com/users/fghdfghdfg5/projects/1240
https://github.com/users/fghdfghdfg5/projects/1241
https://github.com/users/fghdfghdfg5/projects/1242
https://github.com/users/fghdfghdfg5/projects/1243
https://github.com/users/fghdfghdfg5/projects/1244
https://github.com/users/fghdfghdfg5/projects/1245
https://github.com/users/fghdfghdfg5/projects/1246
https://github.com/users/fghdfghdfg5/projects/1247
https://github.com/users/fghdfghdfg5/projects/1248
https://github.com/users/fghdfghdfg5/projects/1249
https://github.com/users/fghdfghdfg5/projects/1250
https://github.com/users/fghdfghdfg5/projects/1251
https://github.com/users/fghdfghdfg5/projects/1252
https://github.com/users/fghdfghdfg5/projects/1253
https://github.com/users/fghdfghdfg5/projects/1254
https://github.com/users/fghdfghdfg5/projects/1255
https://github.com/users/fghdfghdfg5/projects/1256
https://github.com/users/fghdfghdfg5/projects/1257
https://github.com/users/fghdfghdfg5/projects/1258
https://github.com/users/fghdfghdfg5/projects/1259
https://github.com/users/fghdfghdfg5/projects/1260
https://github.com/users/fghdfghdfg5/projects/1261
https://github.com/users/fghdfghdfg5/projects/1262
https://github.com/users/fghdfghdfg5/projects/1263
https://github.com/users/fghdfghdfg5/projects/1264
https://github.com/users/fghdfghdfg5/projects/1265
https://github.com/users/fghdfghdfg5/projects/1266
https://github.com/users/fghdfghdfg5/projects/1267
https://github.com/users/fghdfghdfg5/projects/1268
https://github.com/users/fghdfghdfg5/projects/1269
https://github.com/users/fghdfghdfg5/projects/1270
https://github.com/users/fghdfghdfg5/projects/1271
https://github.com/users/fghdfghdfg5/projects/1272
https://github.com/users/fghdfghdfg5/projects/1273
https://github.com/users/fghdfghdfg5/projects/1274
https://github.com/users/fghdfghdfg5/projects/1275
https://github.com/users/fghdfghdfg5/projects/1276
https://github.com/users/fghdfghdfg5/projects/1277
https://github.com/users/fghdfghdfg5/projects/1278
https://github.com/users/fghdfghdfg5/projects/1279
https://github.com/users/fghdfghdfg5/projects/1280
https://github.com/users/fghdfghdfg5/projects/1281
https://github.com/users/fghdfghdfg5/projects/1282
https://github.com/users/fghdfghdfg5/projects/1283
https://github.com/users/fghdfghdfg5/projects/1284
https://github.com/users/fghdfghdfg5/projects/1285
https://github.com/users/fghdfghdfg5/projects/1286
https://github.com/users/fghdfghdfg5/projects/1287
https://github.com/users/fghdfghdfg5/projects/1288
https://github.com/users/fghdfghdfg5/projects/1289
https://github.com/users/fghdfghdfg5/projects/1290
https://github.com/users/fghdfghdfg5/projects/1291
https://github.com/users/fghdfghdfg5/projects/1292
https://github.com/users/fghdfghdfg5/projects/1293
https://github.com/users/fghdfghdfg5/projects/1294
https://github.com/users/fghdfghdfg5/projects/1295
https://github.com/users/fghdfghdfg5/projects/1296
https://github.com/users/fghdfghdfg5/projects/1297
https://github.com/users/fghdfghdfg5/projects/1298
https://github.com/users/fghdfghdfg5/projects/1299
https://github.com/users/fghdfghdfg5/projects/1300
https://github.com/users/fghdfghdfg5/projects/1301
https://github.com/users/fghdfghdfg5/projects/1302
https://github.com/users/fghdfghdfg5/projects/1303
https://github.com/users/fghdfghdfg5/projects/1304
https://github.com/users/fghdfghdfg5/projects/1305
https://github.com/users/fghdfghdfg5/projects/1306
https://github.com/users/fghdfghdfg5/projects/1307
https://github.com/users/fghdfghdfg5/projects/1308
https://github.com/users/fghdfghdfg5/projects/1309
https://github.com/users/fghdfghdfg5/projects/1310
https://github.com/users/fghdfghdfg5/projects/1311
https://github.com/users/fghdfghdfg5/projects/1312
https://github.com/users/fghdfghdfg5/projects/1313
https://github.com/users/fghdfghdfg5/projects/1314
https://github.com/users/fghdfghdfg5/projects/1315
https://github.com/users/fghdfghdfg5/projects/1316
https://github.com/users/fghdfghdfg5/projects/1317
https://github.com/users/fghdfghdfg5/projects/1318
https://github.com/users/fghdfghdfg5/projects/1319
https://github.com/users/fghdfghdfg5/projects/1320
https://github.com/users/fghdfghdfg5/projects/1321
https://github.com/users/fghdfghdfg5/projects/1322
https://github.com/users/fghdfghdfg5/projects/1323
https://github.com/users/fghdfghdfg5/projects/1324
https://github.com/users/fghdfghdfg5/projects/1325
https://github.com/users/fghdfghdfg5/projects/1326
https://github.com/users/fghdfghdfg5/projects/1327
https://github.com/users/fghdfghdfg5/projects/1328
https://github.com/users/fghdfghdfg5/projects/1329
https://github.com/users/fghdfghdfg5/projects/1330
https://github.com/users/fghdfghdfg5/projects/1331
https://github.com/users/fghdfghdfg5/projects/1332
https://github.com/users/fghdfghdfg5/projects/1333
https://github.com/users/fghdfghdfg5/projects/1334
https://github.com/users/fghdfghdfg5/projects/1335
https://github.com/users/fghdfghdfg5/projects/1336
https://github.com/users/fghdfghdfg5/projects/1337
https://github.com/users/fghdfghdfg5/projects/1338
https://github.com/users/fghdfghdfg5/projects/1339
https://github.com/users/fghdfghdfg5/projects/1340
https://github.com/users/fghdfghdfg5/projects/1341
https://github.com/users/fghdfghdfg5/projects/1342
https://github.com/users/fghdfghdfg5/projects/1343
https://github.com/users/fghdfghdfg5/projects/1344
https://github.com/users/fghdfghdfg5/projects/1345
https://github.com/users/fghdfghdfg5/projects/1346
https://github.com/users/fghdfghdfg5/projects/1347
https://github.com/users/fghdfghdfg5/projects/1348
https://github.com/users/fghdfghdfg5/projects/1349
https://github.com/users/fghdfghdfg5/projects/1350
https://github.com/users/fghdfghdfg5/projects/1351
https://github.com/users/fghdfghdfg5/projects/1352
https://github.com/users/fghdfghdfg5/projects/1353
https://github.com/users/fghdfghdfg5/projects/1354
https://github.com/users/fghdfghdfg5/projects/1355
https://github.com/users/fghdfghdfg5/projects/1356
https://github.com/users/fghdfghdfg5/projects/1357
https://github.com/users/fghdfghdfg5/projects/1358
https://github.com/users/fghdfghdfg5/projects/1359
https://github.com/users/fghdfghdfg5/projects/1360
https://github.com/users/fghdfghdfg5/projects/1361
https://github.com/users/fghdfghdfg5/projects/1362
https://github.com/users/fghdfghdfg5/projects/1363
https://github.com/users/fghdfghdfg5/projects/1364
https://github.com/users/fghdfghdfg5/projects/1365
https://github.com/users/fghdfghdfg5/projects/1366
https://github.com/users/fghdfghdfg5/projects/1367
https://github.com/users/fghdfghdfg5/projects/1368
https://github.com/users/fghdfghdfg5/projects/1369
https://github.com/users/fghdfghdfg5/projects/1370
https://github.com/users/fghdfghdfg5/projects/1371
https://github.com/users/fghdfghdfg5/projects/1372
https://github.com/users/fghdfghdfg5/projects/1373
https://github.com/users/fghdfghdfg5/projects/1374
https://github.com/users/fghdfghdfg5/projects/1375
https://github.com/users/fghdfghdfg5/projects/1376
https://github.com/users/fghdfghdfg5/projects/1377
https://github.com/users/fghdfghdfg5/projects/1378
https://github.com/users/fghdfghdfg5/projects/1379
https://github.com/users/fghdfghdfg5/projects/1380
https://github.com/users/fghdfghdfg5/projects/1381
https://github.com/users/fghdfghdfg5/projects/1382
https://github.com/users/fghdfghdfg5/projects/1383
https://github.com/users/fghdfghdfg5/projects/1384
https://github.com/users/fghdfghdfg5/projects/1385
https://github.com/users/fghdfghdfg5/projects/1386
https://github.com/users/fghdfghdfg5/projects/1387
https://github.com/users/fghdfghdfg5/projects/1388
https://github.com/users/fghdfghdfg5/projects/1389
https://github.com/users/fghdfghdfg5/projects/1390
https://github.com/users/fghdfghdfg5/projects/1391
https://github.com/users/fghdfghdfg5/projects/1392
https://github.com/users/fghdfghdfg5/projects/1393
https://github.com/users/fghdfghdfg5/projects/1394
https://github.com/users/fghdfghdfg5/projects/1395
https://github.com/users/fghdfghdfg5/projects/1396
https://github.com/users/fghdfghdfg5/projects/1397
https://github.com/users/fghdfghdfg5/projects/1398
https://github.com/users/fghdfghdfg5/projects/1399
https://github.com/users/fghdfghdfg5/projects/1400
https://github.com/users/fghdfghdfg5/projects/1401
https://github.com/users/fghdfghdfg5/projects/1402
https://github.com/users/fghdfghdfg5/projects/1403
https://github.com/users/fghdfghdfg5/projects/1404
https://github.com/users/fghdfghdfg5/projects/1405
https://github.com/users/fghdfghdfg5/projects/1406
https://github.com/users/fghdfghdfg5/projects/1407
https://github.com/users/fghdfghdfg5/projects/1408
https://github.com/users/fghdfghdfg5/projects/1409
https://github.com/users/fghdfghdfg5/projects/1410
https://github.com/users/fghdfghdfg5/projects/1411
https://github.com/users/fghdfghdfg5/projects/1412
https://github.com/users/fghdfghdfg5/projects/1413
https://github.com/users/fghdfghdfg5/projects/1414
https://github.com/users/fghdfghdfg5/projects/1415
https://github.com/users/fghdfghdfg5/projects/1416
https://github.com/users/fghdfghdfg5/projects/1417
https://github.com/users/fghdfghdfg5/projects/1418
https://github.com/users/fghdfghdfg5/projects/1419
https://github.com/users/fghdfghdfg5/projects/1420
https://github.com/users/fghdfghdfg5/projects/1421
https://github.com/users/fghdfghdfg5/projects/1422
https://github.com/users/fghdfghdfg5/projects/1423
https://github.com/users/fghdfghdfg5/projects/1424
https://github.com/users/fghdfghdfg5/projects/1425
https://github.com/users/fghdfghdfg5/projects/1426
https://github.com/users/fghdfghdfg5/projects/1427
https://github.com/users/fghdfghdfg5/projects/1428
https://github.com/users/fghdfghdfg5/projects/1429
https://github.com/users/fghdfghdfg5/projects/1430
https://github.com/users/fghdfghdfg5/projects/1431
https://github.com/users/fghdfghdfg5/projects/1432
https://github.com/users/fghdfghdfg5/projects/1433
https://github.com/users/fghdfghdfg5/projects/1434
https://github.com/users/fghdfghdfg5/projects/1435
https://github.com/users/fghdfghdfg5/projects/1436

相關文章