#2
sdta2023-05-08 13:17
对楼主是否有帮助
* 只对双字节字符编(解)码_UTF8编码; * 还有一种常用的GB2312编码,方法逐个取双字节符用 TRANSFORM() 进行转换。 * cc = RIGHT(TRANSFORM(ASC("中"), "@0"), 4) * 还原:CHR(EVALUATE("0x" + cc)) CLEAR lcPath = JUSTPATH(SYS(16)) lc = "西安音12乐学院" ? lc \***************************************** \ URL编码 ? UrlEncode(lc) \ URL解码 ? UrlDecode(UrlEncode(lc)) ? UrlDecode("%E8%A5%BF%E5%AE%89%E9%9F%B3%E4%B9%90%E5%AD%A6%E9%99%A2") STRTOFILE(UrlEncode(lc), "BM.TXT") MODIFY FILE BM.TXT * URL编码 FUNCTION UrlEncode(cStr) LOCAL lcValue, lcEnStr, lc, lnJ, lnK lcEnStr = "" FOR lnJ = 1 TO LEN(cStr) lc = SUBSTR(cStr, lnJ, 1) IF ISLEADBYTE(lc) lc = SUBSTR(cStr, lnJ, 2) lnJ = lnJ + 1 lcValue = STRCONV(STRCONV(lc, 9), 15) FOR lnK = 1 TO LEN(lcValue) STEP 2 lcEnStr = lcEnStr + "%" + SUBSTR(lcValue, lnK, 2) ENDFOR ELSE lcEnStr = lcEnStr + lc ENDIF ENDFOR RETURN lcEnStr ENDFUNC * URL解码 FUNCTION UrlDecode(cEncode) LOCAL lcStr, lnJ, laCode[1] lcStr = "" FOR lnJ = 1 TO ALINES(laCode, cEncode, 5, "%") STEP 3 lcStr = lcStr + STRCONV(STRCONV(laCode[lnJ] + laCode[lnJ + 1] + LEFT(laCode[lnJ + 2], 2), 16), 11) + SUBSTR(laCode[lnJ + 2], 3) ENDFOR RETURN lcStr ENDFUNC |
http://127.0.0.1:9880/chfs/shared/eqpt_file/202305/C6B9##QQ图片20220824145938.jpg
转换成就可以
http://127.0.0.1:9880/chfs/shared/eqpt_file/202305/C6B9%23%23QQ%E5%9B%BE%E7%89%8720220824145938.jpg
VFP用什么方式转换呢
[此贴子已经被作者于2023-5-8 13:05编辑过]