mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Fix import of accented characters
This commit is contained in:
parent
b3a5914f3b
commit
3d072d53d5
|
@ -3,6 +3,8 @@
|
||||||
# VLLilypondType.reader - Import lilypond files
|
# VLLilypondType.reader - Import lilypond files
|
||||||
#
|
#
|
||||||
|
|
||||||
|
$KCODE = 'u'
|
||||||
|
|
||||||
require File.dirname($0)+'/plistWriter'
|
require File.dirname($0)+'/plistWriter'
|
||||||
require File.dirname($0)+'/vl'
|
require File.dirname($0)+'/vl'
|
||||||
|
|
||||||
|
@ -392,11 +394,15 @@ def parseLilypond
|
||||||
tokens[0] = nil
|
tokens[0] = nil
|
||||||
when '\new'
|
when '\new'
|
||||||
if tokens[0] == "Lyrics"
|
if tokens[0] == "Lyrics"
|
||||||
stack.push([block, level, ""])
|
if tokens[1] =~ /^\\/
|
||||||
block = '\lyricmode'
|
tokens[0..1] = nil
|
||||||
level = nestLevel
|
else
|
||||||
STANZAS.push(lyrics= [])
|
stack.push([block, level, ""])
|
||||||
tokens[0..0] = nil
|
block = '\lyricmode'
|
||||||
|
level = nestLevel
|
||||||
|
STANZAS.push(lyrics= [])
|
||||||
|
tokens[0..0] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
when '\relative'
|
when '\relative'
|
||||||
stack.push([block, level, ""])
|
stack.push([block, level, ""])
|
||||||
|
|
|
@ -15,6 +15,18 @@ class PlistData
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _encodeEntities(string)
|
||||||
|
encoded = []
|
||||||
|
string.unpack('U*').each do |ch|
|
||||||
|
if ch <= 0x7F
|
||||||
|
encoded << ch
|
||||||
|
else
|
||||||
|
encoded.concat("&\##{ch};".unpack('C*'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
encoded.pack('C*')
|
||||||
|
end
|
||||||
|
|
||||||
def _encodePlist(destination, object, indent)
|
def _encodePlist(destination, object, indent)
|
||||||
destination.print " "*indent
|
destination.print " "*indent
|
||||||
case object
|
case object
|
||||||
|
@ -23,7 +35,7 @@ def _encodePlist(destination, object, indent)
|
||||||
when true then
|
when true then
|
||||||
destination.print "<true/>\n"
|
destination.print "<true/>\n"
|
||||||
when String then
|
when String then
|
||||||
destination.print "<string>#{object}</string>\n"
|
destination.print "<string>#{_encodeEntities(object)}</string>\n"
|
||||||
when PlistData then
|
when PlistData then
|
||||||
destination.print "<data>#{object}</data>\n"
|
destination.print "<data>#{object}</data>\n"
|
||||||
when Integer then
|
when Integer then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user