VBScript Remove Accents
VBS script to remove accents in a text file in the same directory.
delete_duplicate.vbs
Const accent = "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç"
Const noAccent = "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNnCc"Function sansAccents(ByRef s)
Dim i
Dim lettre
sansAccents = s
For i = 1 To Len(accent)
lettre = Mid(accent, i, 1)
If InStr(sansAccents, lettre) > 0 Then
sansAccents = Replace(sansAccents, lettre, Mid(noAccent, i, 1))
End If
Next
End Function
Dim demo
demo = "L'été, je vais sur l'île où y'a la fête jusqu'à l'aube et" & _
" je hurle: YÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÙÚÛÜùúûü ... "
Wscript.echo demo & vbCrLf & " => " & sansAccents(demo)
Const ForReading = 1
Const ForWriting = 2
lefichier= InputBox("File name :" & VBCRLF & "(Ex: ""toto.txt"")")
If (lefichier <> "") Then
WScript.Sleep 200
else
wscript.Echo "You must enter a file name (in the same directory)"
Wscript.Quit
end ifstrKey=""
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(lefichier, ForReading)Do Until objFile.AtEndOfStream
strName = objFile.ReadLine
'if (len(strName)<6) ThenstrKey = strKey & vbCrLf & LCase(sansAccents(strName))
'End If
LoopobjFile.Close
Set objFile = objFSO.OpenTextFile _
(lefichier, ForWriting)objFile.WriteLine strKey
objFile.Close
FREE
remove-accents.vbs