|
From: | Maurits Lamers |
Subject: | Re: Multi-byte characters in Lyrics |
Date: | Fri, 27 Oct 2017 00:08:26 +0200 |
I cannot convert a multi-byte character to a symbol, unless I do some very inelegant hacks.
It is not a problem on the input side, it is a problem on the processing side. I set up an engraver to listen to lyric events. As the lyrics have to be mapped to braille, I map every character to a specific braille dot pattern. I have to do this in order to support braille embossers, which mostly still are ascii based and are not in agreement on which dot pattern maps to which ascii character. I also want to be able to support unicode. So, every lyric event, I retrieve the text with (ly:event-property event 'text), which then needs to be processed into braille dots, which I achieve by doing (string->list) or could do through (string-ref str pos). This works for almost all situations, except this one. I get a lyric which contains an inverted comma instead of a apostrophe, and literally defined as: "’s He" This inverted comma is a multi-byte character, but I cannot read it as a character, I can only read it as the separate bytes. This is problematic, because as far as I know these characters could have a different meaning by themselves, as they could each can represent a different character.
Couldn't agree more, but at the moment I don't have much choice, and there doesn't seem much benefit in using 2.18 as it seems to suffer from the same problem.
This was a very good lead. With great help from the scheme IRC channel, I figured out that having strings as keys works great, and because they suggested (and provided) an UTF8 byte count counter, I was able to implement a simple function which takes as many characters from the string as required to make a proper match to the assoc list. So, problem solved :) cheers Maurits |
[Prev in Thread] | Current Thread | [Next in Thread] |