[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with
From: |
Daniel Johnson |
Subject: |
Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit) |
Date: |
Fri, 02 Sep 2005 10:42:29 -0700 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050713) |
Mats Bengtsson wrote:
> If you find this added flexibility in LilyPond 2.6 so annoying, then
> you could use some program that converts a Latin1 coded file into
> UTF-8 coding and even make a script file that first does the
> conversion and then calls LilyPond. Unfortunately, I don't know
> Windows well enough to provide any specific hints but there should
> be several possibilities available.
>
> /Mats
>
This sounds like a job for a sed script, but...
I offer the following with NO WARRANTY. I haven't used Windows in about
a year so this is all from memory, but I am enclosing a VBScript file
that should perform conversion from Latin-1 to UTF-8. I haven't tested
this. Also, I never did figure out how to use command-line args with
VBS, so you'll have to hardcode the input and output filenames each time
(unless you have on-hand a guru who can improve this thing). Anyhow,
here goes. You'll want to save this with a ".vbs" extension.
'==== begin VBScript code ====
Option Explicit
Dim sInFileName, sOutFileName
sInFileName = "" ' Filename you wish to convert (with full path)
sOutFileName = "" ' Filename you want for the output
Dim oFSO
Dim oInFile, sInString
Dim oOutFile, sOutString
Dim i, s
Dim sTransArray(255)
'Populate the translation table
For i = 128 To 191
sTransArray(i) = chr(&HC2) & chr(i)
Next
For i = 192 To 255
sTransArray(i) = chr(&HC3) & chr(i - 64)
Next
'Read the input file as a single string
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oInFile = oFSO.OpenTextFile(sInFileName, 1, False, 0)
sInString = oInFile.ReadAll
oInFile.Close
Set oInFile = Nothing
'Perform char-by-char translation
sOutString = ""
For i = 0 To Len(sInString)
s = Mid(sInString, i, 1)
If Asc(s) < 128 Then
sOutString = sOutString & s
Else
sOutString = sOutString & sTransArray(Asc(s))
End If
Next
'Write the resulting file to the output file
Set oOutFile = oFSO.OpenTextFile(sOutFileName, 2, True, 0)
oOutFile.Write(sOutString)
oOutFile.Close
'Perform final housekeeping
Set oOutFile = Nothing
Set oFSO = Nothing
End
'==== end VBScript code ====
- Re: Wrong characters with jEdit, stk, 2005/09/01
- Re: Wrong characters with jEdit, Mats Bengtsson, 2005/09/01
- How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit), stk, 2005/09/02
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit), Mats Bengtsson, 2005/09/02
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit),
Daniel Johnson <=
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characterswith jEdit), Hans de Rijck, 2005/09/02
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characterswith jEdit), stk, 2005/09/02
- Re: How can I avoid unicode and use Latin1?, Jan Nieuwenhuizen, 2005/09/02
- Re: How can I avoid unicode and use Latin1?, stk, 2005/09/04
- Re: How can I avoid unicode and use Latin1?, Pedro Kröger, 2005/09/04
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit), stk, 2005/09/02
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit), stk, 2005/09/04
- Re: How can I avoid unicode and use Latin1?, Jan Nieuwenhuizen, 2005/09/04
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit), stk, 2005/09/02
- Re: How can I avoid unicode and use Latin1? (Was: Wrong characters with jEdit), Han-Wen Nienhuys, 2005/09/02