lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode chars in scheme?


From: Tao Cumplido
Subject: Re: Unicode chars in scheme?
Date: Wed, 24 Jun 2009 19:14:49 +0200

> Perhaps I'm not understanding the remaining issue to be solved if
> there is one. Clear me up if that's the case.

Well, it's a little complex, but what I basically need is a function which 
replaces every char from a string to its counterpart specified in an alist. And 
these counterparts are all in the non-ASCII area.
Actually I don't need the console output, that was just for testing.

I think I found out what happens.
Guile doesn't seem to use UTF-8 encoding (yet) which probably leads to this 
strange results.
http://www.gnu.org/software/guile/manual/html_node/Conversion-to_002ffrom-C.html#Conversion-to_002ffrom-C

I solved the problem for now by associating each char from the input string 
with the desired char in a string format which are then appended to a new 
string. It's not really straight but seems to be the only possible solution so 
far.

#(define (super-string s)
   (if (string? s)
     (let ((n (string-length s))
           (s2 ""))
       (do ((i 0 (1+ i))) ((= i n))
         (let* ((c (cdr (assoc (string-ref s i) super-ref char=?)))
                (l (string-length c)))
           (do ((a 0 (1+ a))) ((= a l))
             (set! s2 (string-append s2 (string (string-ref c a)))))))
       s2)))

It's a little chaotic but it works.
A minimal sample of (super-ref) could be:

#(define super-ref
   (list
     (cons #\A "Ø")
  ))

Thanks for the help.

Regards,

Tao
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01




reply via email to

[Prev in Thread] Current Thread [Next in Thread]