![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-19 09:15 |
47,814 topics / 349,908 posts / today 0 new / 48,259 members |
| DOS批处理 & 脚本技术(批处理室) » It is "it is said", "unicode to ANSI batch processing" is "batch processing for converting Unicode to ANSI". So the translation is: It is said batch processing for converting Unicode to ANSI |
| Printable Version 2,995 / 6 |
| Floor1 electronixtar | Posted 2006-10-23 08:23 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
```
@Echo off Md temp For %%a in (*.inf) Do Type %%a >Temp\%%a Copy Temp\*.inf /y Del Temp\*.inf Rd Temp Converting many *.inf, *.ini, etc. Unicode formats to ANSI can reduce file size without changing functionality! Everyone, think about it, can we make a registry cleanup based on this principle? [ Last edited by electronixtar on 2006-10-23 at 08:24 ] ``` |
|
| Floor2 namejm | Posted 2006-10-23 08:32 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Can converting Unicode to ANSI format really ensure that the functionality remains unchanged? Although I don't know if it's correct, I have some doubts about this statement. Those who know, please explain the principle.
|
|
| Floor3 electronixtar | Posted 2006-10-23 08:40 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Because Unicode uses 2 bytes to store English, while ANSI only uses 1 byte. Many inf files in the system are completely sufficient with ANSI.
|
|
| Floor4 nipo | Posted 2008-05-11 13:20 |
| 中级用户 Posts 106 Credits 228 | |
|
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 ] |
|
| Floor5 slore | Posted 2008-05-11 14:40 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
Can your BAT run normally?
|
|
| Floor6 knoppix7 | Posted 2008-05-11 18:21 |
| 银牌会员 Posts 634 Credits 1,287 From cmd.exe | |
|
It can also be done with cmd /a(/u) and it's safe..
|
|
| Floor7 nipo | Posted 2008-05-11 21:43 |
| 中级用户 Posts 106 Credits 228 | |
|
Reply to floor 5:
I am using .cmd and it runs normally. Reply to floor 6: Thank you for the tip. I also saw the relevant post and checked cmd/?. The reason I am interested in the method of this post is not only for encoding conversion but also for its TYPE function. This can at least theoretically confirm that Unicode-encoded files can be operated independently in the DOS environment. Specifically, I am still a novice in text processing. I hope to attract the attention of all experts to this issue. Let's work together to accelerate the solution of this problem. This issue is very important for DOS. If the Unicode issue is not solved, it will compress the living space of DOS. Not only in text processing but also in many applications such as the network. Once it is solved, DOS will get a new world. [ Last edited by nipo on 2008-5-11 at 09:47 PM ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |