Re: [Audacity-devel] non-ascii labels
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
|
From: Dominic M. <do...@au...> - 2006-08-20 10:24:25
|
On Aug 20, 2006, at 2:51 AM, Leland wrote:
>> When I save the project and reopen it, I get an error messge,
>> "Error: not well formed at line 148". Line 148 is the first label
>> line
>> that contains japanese text. The encoding of the .aup file appears
>> to be cp-932 (the default for my system). I'm non-sure why the
>> non-unicode build would produce a valid utf-8 file, and the non-
>> unicode
>> build would produce an illegal xml file (since there is no encoding
>> declaration in it, the xml reader will assume utf-8, but it is
>> actually
>> cp-932).
>>
> This is a definite problem and one that I'll have to ask the others
> for
> advice on. Basically, we need to be able to allow and handle Unicode
> strings within the aup file.
The right place for the fix would be in the XMLEsc function in xml/
XMLTagHandler.cpp. I thought something like this would work,
encoding non-ASCII characters as hexadecimal:
default:
if (c > 127) {
result += wxString::Format("&#%d;", c);
}
else if (c < 0 && c >= -128) {
result += wxString::Format("&#%d;", 256 + c);
}
else if (c < -128) {
result += wxString::Format("&#%d;", 65536 + c);
}
else
result += c;
It partially works for me - the correct character comes through, but
another funny character appears also...
- Dominic
|