File: convert.tcl

package info (click to toggle)
amsn 0.98.3-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,876 kB
  • ctags: 10,292
  • sloc: tcl: 117,923; ansic: 32,173; cpp: 17,387; xml: 6,643; objc: 1,251; sh: 667; makefile: 544; perl: 215; python: 126
file content (21 lines) | stat: -rwxr-xr-x 401 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/tclsh

if {[llength $argv] < 4} {
	puts "  Use: convert source_file source_encoding dest_file dest_encoding"
	exit
}

set fsource [open "[lindex $argv 0]" r]
set fdest [open "[lindex $argv 2]" w]


fconfigure $fsource -encoding [lindex $argv 1]
fconfigure $fdest -encoding [lindex $argv 3]


while {[gets $fsource tmp_data] != "-1"} {
	puts $fdest "$tmp_data"
}

close $fsource
close $fdest