rss
Search : in
By : Relevance Date Username
Statut : Not resolved

Replace unicode

Nafisia, on Sunday April 6, 2008 01:10:00 PM
Hello,


I constract a file via batch file. And i that file i need to replace all entries of ';' to character cedille which has unicode '0xB8'.
Configuration: Windows XP
Internet Explorer 6.0
Reply to Nafisia  Report this message to moderators Go to last message

1


  • 1
    This message seems useful, vote!
  • Ce message ne vous semble pas utile, votez !
  • Report this message to moderators
Mrhack, on Sunday April 6, 2008 03:58:37 PM
I'm not sure you can; CMD is ASCII, not Unicode.
VBScript, however, has no such limitation. The following (untested) script should do what you need. The red parts are: the input file, the output file, what you're looking for, and what to replace it with, respectively.


Const input = "inFile.txt"
Const output = "outFile.txt"
Const findWhat = ";"
Const repWith = "¸"
Set regXp = New RegExp
regXp.Global = True
regXp.Pattern = findWhat
With CreateObject("Scripting.FileSystemObject")
Set fOut = .OpenTextFile(output, 2, True, -1)
'Replace this -2 with either -1 or 0, if needed.
With .OpenTextFile(input, 1, False, -2)
Do Until .AtEndOfStream
fOut.WriteLine regXp.Replace(.ReadLine, repWith)
Loop
End With
End With
Reply to Mrhack

2


  • This message seems useful, vote!
  • Report this message to moderators
 val, on Tuesday April 22, 2008 04:33:44 AM
thanks Mrhack for that snipped of code, worked for me to replace some unicode chars
Reply to val