Ms-Dos - Codificación fichero

 
Vista:
sin imagen de perfil

Codificación fichero

Publicado por Cris (21 intervenciones) el 10/07/2013 14:27:15
Buenas tardes, de nuevo acudo al foro en busca de ayuda.

No sé si lo que intento hacer es viable.

¿Se puede guardar un fichero.txt (ANSI) con codificación UFT-8 a base de comandos?

Con "notepad fichero.txt" lo abro con el bloc de notas, pero no sé continuar.

He probado con iconv.exe, pero no funciona, quizá por los 64 bits (he leído algo al respecto).

Un saludo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Codificación fichero

Publicado por Cris (21 intervenciones) el 12/07/2013 16:40:03
Hola, he conseguido convertir un txt ANSI a UFT-8 con un VBScript.

Pongo el código por si le es útil a alguien:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Set stream = CreateObject("ADODB.Stream")
stream.Open
stream.Type = 2 'text
stream.Charset = "utf-8"
stream.LoadFromFile "fichero1.txt"
text = stream.ReadText
stream.Close
 
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("fichero1.txt", 2, True, True)
f.Write text
f.Close
 
Dim oIn: Set oIn = CreateObject("ADODB.Stream")
Dim oOut: Set oOut = CreateObject("ADODB.Stream")
 
oIn.Open
oIn.LoadFromFile "fichero1.txt"
oOut.CharSet = "UTF-8" ' Just change this to the desired charset.
oOut.Open
oOut.WriteText oIn.ReadText
oOut.SaveToFile "fichero2.txt"
oOut.Close
oIn.


Un saludo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar