『第 4 楼』:
测试结果令人鼓舞,也有点奇怪!
使用 LLM 解释/回答一下
双向测试了一个文本,
1、ANSI的。名称RVI.txt,内容如下:
{N=2,300,14}
V1:=((C-O)+2*(REF(C-O,1)+REF(C-O,2)+REF(C-O,3)))/6;
V2:=((H-L)+2*(REF(H-L,1)+REF(H-L,2)+REF(H-L,3)))/6;
NUM:=SUM(V1,N);
DENUM:=SUM(V2,N);
RVI:NUM/DENUM;
RVISIG:(RVI+2*(REF(RVI,1)+REF(RVI,2)+REF(RVI,3)))/6
测试用的代码:
cls
::@Echo off
del /s /q RVI.inf RVI_cheng.inf
echo.
For %%a in (RVI.txt) Do Type %%a >RVI.inf
echo.
For %%a in (RVI.inf) Do Type %%a >RVI_cheng.inf
start RVI.inf
start RVI_cheng.inf
exit
测试结果:
RVI.inf---UNICODE编码,显示正常。
RVI_cheng.inf---ANSI编码,显示字符异常。如下:
{ N = 2 , 3 0 0 , 1 4 }
V 1 : = ( ( C - O ) + 2 * ( R E F ( C - O , 1 ) + R E F ( C - O , 2 ) + R E F ( C - O , 3 ) ) ) / 6 ;
V 2 : = ( ( H - L ) + 2 * ( R E F ( H - L , 1 ) + R E F ( H - L , 2 ) + R E F ( H - L , 3 ) ) ) / 6 ;
N U M : = S U M ( V 1 , N ) ;
D E N U M : = S U M ( V 2 , N ) ;
R V I : N U M / D E N U M ;
R V I S I G : ( R V I + 2 * ( R E F ( R V I , 1 ) + R E F ( R V I , 2 ) + R E F ( R V I , 3 ) ) ) / 6
2、UNCODE的。名称RVI_other.txt,内容不变。
测试代码,除了改一下文件名称,别的没变:
:clss
::@Echo off
del /s /q RVI_other.inf RVI_other_cheng.inf
echo.
For %%a in (RVI_other.txt) Do Type %%a >RVI_other.inf
echo.
For %%a in (RVI_other.inf) Do Type %%a >RVI_other_cheng.inf
start RVI_other.inf
start RVI_other_cheng.inf
exit
测试结果:
生成RVI_other.inf、RVI_other_cheng.inf。显示都和原本一样,但都是ANSI编码的。
这个测试说明,此Type方法确实能造成字符编码的改变,但机制还不清楚。尤其是第一个测试UNICODE-->ANSI造成字符显示异常,而第二个测试同样用UNCODE码却显示正常,不解。
Last edited by nipo on 2008-5-11 at 01:40 PM ]
Bidirectional test of a text,
1. ANSI. The name is RVI.txt, and the content is as follows:
{N=2,300,14}
V1:=((C-O)+2*(REF(C-O,1)+REF(C-O,2)+REF(C-O,3)))/6;
V2:=((H-L)+2*(REF(H-L,1)+REF(H-L,2)+REF(H-L,3)))/6;
NUM:=SUM(V1,N);
DENUM:=SUM(V2,N);
RVI:NUM/DENUM;
RVISIG:(RVI+2*(REF(RVI,1)+REF(RVI,2)+REF(RVI,3)))/6
The test code:
cls
::@Echo off
del /s /q RVI.inf RVI_cheng.inf
echo.
For %%a in (RVI.txt) Do Type %%a >RVI.inf
echo.
For %%a in (RVI.inf) Do Type %%a >RVI_cheng.inf
start RVI.inf
start RVI_cheng.inf
exit
Test results:
RVI.inf - - - UNICODE encoding, normal display.
RVI_cheng.inf - - - ANSI encoding, abnormal character display. As follows:
{ N = 2 , 3 0 0 , 1 4 }
V 1 : = ( ( C - O ) + 2 * ( R E F ( C - O , 1 ) + R E F ( C - O , 2 ) + R E F ( C - O , 3 ) ) ) / 6 ;
V 2 : = ( ( H - L ) + 2 * ( R E F ( H - L , 1 ) + R E F ( H - L , 2 ) + R E F ( H - L , 3 ) ) ) / 6 ;
N U M : = S U M ( V 1 , N ) ;
D E N U M : = S U M ( V 2 , N ) ;
R V I : N U M / D E N U M ;
R V I S I G : ( R V I + 2 * ( R E F ( R V I , 1 ) + R E F ( R V I , 2 ) + R E F ( R V I , 3 ) ) ) / 6
2. UNCODE. The name is RVI_other.txt, and the content remains unchanged.
The test code, except for changing the file name, is the same:
:clss
::@Echo off
del /s /q RVI_other.inf RVI_other_cheng.inf
echo.
For %%a in (RVI_other.txt) Do Type %%a >RVI_other.inf
echo.
For %%a in (RVI_other.inf) Do Type %%a >RVI_other_cheng.inf
start RVI_other.inf
start RVI_other_cheng.inf
exit
Test results:
Generate RVI_other.inf and RVI_other_cheng.inf. Both displays are the same as the original, but both are ANSI encoding.
This test shows that this Type method can indeed cause a change in character encoding, but the mechanism is not clear. Especially in the first test, UNICODE -> ANSI causes abnormal character display, while in the second test, using UNCODE code also displays normally, which is puzzling.
Last edited by nipo on 2008-5-11 at 01:40 PM ]
|