Error: reference to invalid character number at line 6

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Error: reference to invalid character number at line 6

Post by steve » Fri Sep 29, 2017 12:18 pm

steve wrote:It would appear that an alternative solution would be to build WxWidgets on Windows with wxUSE_UNICODE_UTF8=1 so that UTF-8 encoding is used on all platforms.
but on the other hand, perhaps not.
Although that document seems to suggest that we can use wxUSE_UNICODE_UTF8=1 on Windows, further reading suggests that a lot can go wrong if attempting to do so.
As an experiment, I built wxWidgets with wxUSE_UNICODE_UTF8=1, and then attempted to build Audacity, but got stuck with linker errors.

I'm coming round to your approach ;-)

UTF-8 would be such a great idea, if only MS ....
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Yarn366
Posts: 36
Joined: Sat May 20, 2017 11:31 pm
Operating System: Windows 7

Re: Error: reference to invalid character number at line 6

Post by Yarn366 » Fri Sep 29, 2017 5:56 pm

steve wrote: Although that document seems to suggest that we can use wxUSE_UNICODE_UTF8=1 on Windows, further reading suggests that a lot can go wrong if attempting to do so.
As an experiment, I built wxWidgets with wxUSE_UNICODE_UTF8=1, and then attempted to build Audacity, but got stuck with linker errors.
Even if you didn't get linker errors, there would still be a problem with Audacity using UTF-8 on Windows: wxString's character-access functions use wxUniChar, which is 4 bytes on all platforms, but Audacity never uses that and instead uses wxChar and wxUChar, which are just wchar_t when wxUSE_UNICODE==1. And as you may or may not know, wchar_t is only 2 bytes on Windows (whereas it's 4 bytes on Linux and macOS). Since wxString actually decodes UTF-8, this would result in supplementary characters being truncated and therefore corrupted due to casting wxUniChar (4 bytes) to wxChar or wxUChar (2 bytes on Windows).

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Error: reference to invalid character number at line 6

Post by steve » Fri Sep 29, 2017 8:13 pm

I've sent you a PM Yam366.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Error: reference to invalid character number at line 6

Post by steve » Mon Nov 13, 2017 5:32 pm

I've committed the fix for this, so barring unforeseen problems it should be fixed in Audacity 2.2.1 in December.
Many thanks to Yam366 for providing the fix and helping me to understand the problem.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

waxcylinder
Forum Staff
Posts: 14684
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Error: reference to invalid character number at line 6

Post by waxcylinder » Mon Nov 13, 2017 5:55 pm

steve wrote:Many thanks to Yam366 for providing the fix and helping me to understand the problem.
I second that vote of thanks for Yam366

WC
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Post Reply