Error Export2 filename with "ñ" or "`" although UTF-8 encoding

I have a weird issue on windows 10 and Audacity 2.3.2 and 2.4.1 for MAC Catalina .
Using, Export2 filename string with “ñ” (n with tilde over it) or accents, BatchCommand finished but Failed.
Before says Command sequence was not recognized.
On top is # -- coding: utf-8 --
And the coding on the code editor is UTF-8 too.
So it’s so strange because printing filename catching it, on command line is right written.
Can anybody help me on it?
Thank you and best regards

My advice would be to stick with ASCII data. It should be possible to handle Unicode characters beyond the first 128, but it can become hugely complicated to do so.

There’s a long forum thread here where we tried to handle Chinese characters in labels (we didn’t succeed)

Hi Steve!
Seems it work!!!

The post you recomended gave me some ideas.
First, to test the characters, convert to bytes the string (with python 3.8):

my_string = "mañana"
my_string_in_bytes = str.encode(my_string)
>> ma\xc3\xb1ana    // this is only to see what to replace

Now in the main code force replace “ñ” by “\xc3\xb1”:

my_new_string = my_string.replace("ñ", "\xc3\xb1")

When Export2: … Filename=“’ + my_new_string + '.wav” … what Audacity actually do is saving the file as a caracter I don’t how to reproduce here but attached picture.

I don’t know what it means (if Audacity is able to understand byte and then decode himself) but works.

And when went to the folder to see the name of the file it’s writted with “ñ” !!!

Thank you and best regards

Excellent :slight_smile:

Do be aware though that there’s lots of scope for things to go wrong :wink:
If you’re using UTF-8 data, then be sure that you only use UTF-8 and not a mix of UTF-8 and other character. As you can see from that other thread, the results of having an unrecognized character can be a lot more serious in a program than just getting a “�”.

The other big “gotcha” to watch out for, is Nyquist plug-ins (plug-ins “below the line” in the Effect menu). Nyquist is pure ASCII and does not understand Unicode at all. You “may” get away with sending a Unicode string to Nyquist, but there’s a high chance that you won’t get what you are expecting. We’ve made some improvements since that other thread to make things safer, but it’s not perfect.

Thank you Steve!
I’m very pleased with Audacity and that forum!! :wink:
The mod-scrip is the way and provide us to be competitive.
So thank you at all for everything