标题: [已结]怎样取汉字的编码
[打印本页]
作者: HAT
时间: 2007-8-21 13:21
标题: [已结]怎样取汉字的编码
大家知道,把下面这句代码中的空格去掉,帖到BBS上会变成汉字"我"。
&# 25105;
请问这个25105采用的是什么编码方式?
怎样在批处理中获取任意汉字的这种编码?
搜索了很久,没找到解决解决方案,望高人指点。
[
Last edited by HAT on 2008-11-12 at 21:40 ]
作者: HAT
时间: 2007-8-21 13:22
测试:
我
作者: slore
时间: 2007-8-21 13:58
MsgBox AscW
("
轩"
) 'Unicode编码
作者: HAT
时间: 2007-8-21 14:37
多谢slore兄
作者: mkd
时间: 2008-7-24 21:41
字 -> code
@echo off
echo 请输入任意汉字
set /p str=
reg add HKCU\Environment\unistr /v str /t reg_expand_sz /d "%str%" /f >nul
reg export HKCU\Environment\unistr tmp.reg >nul
for /f "skip=3 delims=\ " %%a in ('type tmp.reg') do call set str_code_16=%%str_code_16%%%%a
set str_code_16=%str_code_16:*:=%
set str_code_16=%str_code_16:~0,-6%
for %%a in ("%str_code_16:,= "%) do (
for /f "tokens=1,2" %%i in ("%%a") do (
for /l %%m in (0x%%~j%%~i,1,0x%%~j%%~i) do call set "str_code_10=%%str_code_10%%&#%%m;"
)
)
reg delete HKCU\Environment\unistr /f >nul
del tmp.reg
set str_code
::>rrr.txt set str_code
pause
code -> 字
@echo off
if "%~1" == "newcmd" goto newcmd
echo 请输入这种编码f7,8b,93,8f,65,51
set /p Ucode=
>tmp.reg echo Windows Registry Editor Version 5.00
>>tmp.reg echo.
>>tmp.reg echo [HKEY_CURRENT_USER\Environment]
>>tmp.reg echo "Ustr"=hex(2):%Ucode%,00,00
regedit /s tmp.reg
>nul wmic environment create name="_ddd",variableValue="ddd",username="%username%"
>nul wmic process call create "%~s0 newcmd"
>nul wmic environment where ( name="_ddd" or name="Ustr" ) delete
del tmp.reg
goto :eof
:newcmd
cd /d "%~sdp0"
@echo on
set Ustr
pause