[audacity4blind] Nyquist Unicode support (was: Audacity Plugins)

  • From: Steve the Fiddle <stevethefiddle@xxxxxxxxx>
  • To: audacity4blind@xxxxxxxxxxxxx
  • Date: Fri, 30 Jan 2015 12:53:06 +0000

Starting a new thread as this has drifted away from the original topic.
Reply to Robert's comments in-line below:

On 30 January 2015 at 06:31, Robert Hänggi <aarjay.robert@xxxxxxxxx> wrote:
>> Nyquist itself is case insensitive ASCII - no Unicode support at all,
>> and I think that is unlikely to change in the foreseeable future,
>> It "may" be possible to allow Unicode characters in the header
>> statements as those are ignored (commented out) for Nyquist. I'll
>> mention when work starts on version 5 headers.
>>
>> Steve
>>
>
> Well, it does actually translate my surname correct after converting
> to utf-8 (which I did previously actually).
> However, I'm not sure if the encoding would function with all platforms.
>
> I think that strings are already translated from/to Unicode.
>
> For example:
> Within the Nyquist prompt, I have 3 possibilities to let my name
> appear in the message box:
>
> (print "hänggi")
> (print "h\303\244nggi")
> (print "h\344nggi")
>
> Only the last one throws a warning out.
> However, it's needed to e.g. access my document folder within XLISP.
> In other words, Nyquist translates the first string into the second
> one which has afterwards to be translated into the third one (file
> operations only).

When entering a string, Audacity reads the string and uses a wxWidgets
function
to convert it to 8 bit ISO-8859-1 characters.
If wxWidgets encounters a string that looks like an invalid UTF-8
characters,
Audacity generates a warning (not an error).

In your example, Nyquist sees the second character of your name "hänggi"
as an escape character \303, which is the first half of the two byte
character code.

Thus you can do something like this:
(setq a (subseq "hänggi" 1 2)) ; escape code \303
(setq b (subseq "hänggi" 2 3)) ; escape code \244
(format nil "~a~a" a b)

which should print the string "ä"
which is two 8 bit ANSI characters converted (by Audacity) to a single 2
byte UTF-8 character.

In the Nyquist Prompt you can do this using the Debug button:

(print (setq a (subseq "hänggi" 1 2))) ; prints to debug escape code \303
(print (setq b (subseq "hänggi" 2 3))) ; prints to debug escape code \244
(format nil "~a~a" a b) ; returns string ä

Steve


>
> Something similar happens after a crash. Audacity warns at recovery
> time, although it works properly.
> The reason is just that darn "ä" in my user path.
>
> I think I'll stick to the "ae" for the time being.
>
> Thanks Steve.
>
> Robert

Other related posts: