China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-03 17:11
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » File encoding conversion View 2,251 Replies 17
Original Poster Posted 2007-03-09 06:31 ·  中国 云南 普洱 电信
初级用户
Credits 26
Posts 11
Joined 2007-03-09 04:28
19-year member
UID 81145
Gender Male
Status Offline
How to write a batch script to convert UTF-8 encoding to ANSI encoding? Please help, experts.
Floor 2 Posted 2007-03-09 06:37 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Generally, it is best to convert by finding a comparison table method
Floor 3 Posted 2007-03-09 07:06 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
The landlord gives an example to see, what is converted into what (a bit confused..) :)
Floor 4 Posted 2007-03-09 07:23 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
It seems that it is directly converted with for.

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 5 Posted 2007-03-09 11:49 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Originally posted by electronixtar at 2007-3-8 06:23 PM:
It seems that it can be converted directly with for.


I converted it like this
more utf8.txt >ansi.txt
%cmdspec% /u more ansi.txt >utf8.txt

How to convert with for
Floor 6 Posted 2007-03-09 21:30 ·  中国 云南 普洱 电信
初级用户
Credits 26
Posts 11
Joined 2007-03-09 04:28
19-year member
UID 81145
Gender Male
Status Offline
Who can give me the source code? The problem hasn't been solved yet.
Floor 7 Posted 2007-03-09 22:00 ·  中国 上海 浦东新区 电信
初级用户
★★
Credits 196
Posts 82
Joined 2005-09-26 11:31
20-year member
UID 42842
Status Offline
Can this be achieved with DOS too? So amazing!
I just know there is a software called convertZ that can achieve this function, and it can also do it in batches. LZ, do you want to give it a try?
Floor 8 Posted 2007-03-09 22:09 ·  中国 云南 普洱 电信
初级用户
Credits 26
Posts 11
Joined 2007-03-09 04:28
19-year member
UID 81145
Gender Male
Status Offline
Originally posted by pillow at 2007-3-9 09:00 AM:
?? Can this be achieved with DOS too? So amazing!
I just know there is a software called convertZ that can achieve this function, and it can also do batch processing. LZ, do you want to give it a try?

How to do batch processing for this? Please help.
I usually use Notepad to convert, but I don't know how to do batch processing with Notepad.
Floor 9 Posted 2007-03-09 22:10 ·  中国 上海 浦东新区 电信
初级用户
★★
Credits 196
Posts 82
Joined 2005-09-26 11:31
20-year member
UID 42842
Status Offline
It's not that you can batch convert with Notepad,

It means convertZ can
Floor 10 Posted 2007-03-09 23:57 ·  中国 云南 普洱 电信
初级用户
Credits 26
Posts 11
Joined 2007-03-09 04:28
19-year member
UID 81145
Gender Male
Status Offline
Originally posted by pillow at 2007-3-9 09:10 AM:
It's not that you can use Notepad for batch conversion,

It means that convertZ can

I downloaded this software, but it seems there's no way to write batch processing code. What I need to do is to change the file encoding in the form of a batch file.
Floor 11 Posted 2007-03-09 23:59 ·  中国 云南 普洱 电信
初级用户
Credits 26
Posts 11
Joined 2007-03-09 04:28
19-year member
UID 81145
Gender Male
Status Offline
Originally posted by zh159 at 2007-3-8 05:37 PM:
It is generally best to convert by looking up a comparison table.

Your suggestion is very good. Can you be more detailed?
Floor 12 Posted 2007-03-10 01:31 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
You mean how to handle the following?
Attachments
{9CF85646-5EEF-48EA-AA47-D1BC862DA4C7}.BMP
Floor 13 Posted 2007-03-10 01:39 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Using the TYPE command is the simplest: type c:\u8.txt > c:\a.txt
Floor 14 Posted 2007-03-10 01:58 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
So it was type, I mistook it for for.

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 15 Posted 2007-03-10 05:30 ·  中国 云南 普洱 电信
初级用户
Credits 26
Posts 11
Joined 2007-03-09 04:28
19-year member
UID 81145
Gender Male
Status Offline
Originally posted by HUNRYBECKY at 2007-3-9 12:39 PM:
The simplest way to use the TYPE command: type c:\u8.txt >c:\a.txt

This only achieves outputting the content of u8.txt to a.txt, which is similar to renaming the file.
Forum Jump: