Page 1 of 1
Invalid character number + Open' command to open...
Posted: Sat Apr 01, 2017 6:05 pm
by Kalum
Today when I opened the .aup file of my latest episode I get the following:
Error: reference to invalid character number at line 57.
After a Google search I tried opening the file with Notepad to edit as recommended in the following FAQ "Why do I get "Error: not well formed (invalid token) at line x"?"
http://manual.audacityteam.org/man/faq_errors.html#nwf
My interpretation was that I need to remove "��" from two lines where it appeared as below
<wavetrack name="�� Campfire On The beach Ambience - 8 Hours Relaxing Ocean Wave Sounds Calming Crackling Fire Sound"
After doing that and saving in Notepad, when double clicking the .aup file to open it I have the following message:
"file name" is an audacity project file. Use the 'File > Open' command to open Audacity Projects.
Anyone could help / knows what I'm doing wrong?
Thanks in advance for your help.
FYI my PC is Win10
Re: Invalid character number + Open' command to open...
Posted: Sat Apr 01, 2017 6:16 pm
by Kalum
Little detail.
I found the source (not how to fix)of the original problem.
Turns out one of the audio file I inserted in that .aup had a sort of emoji in it's name.
I didn't notice it before inserting (which worked till I had to re-open the file) and I had never that.
This emoji is likely responsible for that "��" bit appearing as part of the file name (two places) in the code when opening the aup with Wordpad

Re: Invalid character number + Open' command to open...
Posted: Sat Apr 01, 2017 6:25 pm
by Kalum
Ok I solved myself.
Sorry for the panic from a total noob.
So in the end, what was needed after applying the "Why do I get "Error: not well formed (invalid token) at line x"?" method was to put the setting "ANSI" when doing Save As in Notepad.
By default it was on a different setting and that's apparently why it would open in Audacity after saving.

Re: Invalid character number + Open' command to open...
Posted: Sun Apr 02, 2017 1:15 pm
by Gale Andrews
Thanks for following up.
Kalum wrote:Ok I solved myself.
Sorry for the panic from a total noob.
So in the end, what was needed after applying the "Why do I get "Error: not well formed (invalid token) at line x"?" method was to put the setting "ANSI" when doing Save As in Notepad.
By default it was on a different setting and that's apparently why it would open in Audacity after saving.
Audacity project files are encoded as UTF-8 but Notepad's choice for saving as that adds a
BOM which Audacity can't interpret.
Saving as ANSI would leave you with more invalid token errors if you had
Unicode characters in the file. So in some cases you're never going to be able use Notepad to correct the file.
Gale
Re: Invalid character number + Open' command to open...
Posted: Sun Apr 02, 2017 4:02 pm
by Edgar
Gale Andrews wrote:
Saving as ANSI would leave you with more invalid token errors if you had
Unicode characters in the file. So in some cases you're never going to be able use Notepad to correct the file.
google:
windows notepad always utf
and look at:
https://answers.microsoft.com/en-us/win ... e6b498712c
or:
https://superuser.com/questions/557023/ ... in-notepad
there is a YouTube video:
https://www.youtube.com/watch?v=GnL6smxQE9k
The result is that thereafter Notepad always defaults to UTF-8 (you can always manually override with the "Encoding" dropdown. Assuming (?) Audacity can open UTF-8 encoded AUP files (it has no problem opening other UTF-8 files), this might solve the open problem. Writing the AUP (an XML file) might want to be changed so it is an UTF-8 file...
This is an (truncated) AUP from Audacity 2.0:
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "
http://audacity.sourceforge.net/xml/aud ... -1.3.0.dtd" >
<project xmlns="
http://audacity.sourceforge.net/xml/" projname="ua_data" version="1.3.0" audacityversion="2.0.1" sel0="0.0000000000" sel1="2.0000000000" vpos="0" h="0.0000000000" zoom="862.0000000000" rate="44100.0">
[...stuff removed...]
</project>
This another app's similar file (also truncated):
<?xml version="1.0" encoding="utf-8"?>
<!---->
<!--KnowBrainer Professional XML Command File-->
Re: Invalid character number + Open' command to open...
Posted: Mon Apr 03, 2017 1:29 pm
by Gale Andrews
Ed,
We're talking about editing AUP files not creating new ones, but as far as I can see Notepad on Windows 10 does not change the encoding of an existing UTF-8 AUP file to ANSI, even if its last Save As was ANSI.
Notepad does however add BOM to the UTF-8 encoding as I said, and that does then render the file unopenable in Audacity. To open the AUP file you would then have to remove the BOM in a more advanced editor like Notepad++.
Fortunately if the project contains no Unicode characters, then Audacity saves the AUP file as ANSI, and in that case you can open the AUP file in Notepad, then edit and save. The file remains as ANSI and Audacity can still open it.
Gale