Invalid character number + Open' command to open...

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.
Post Reply
Kalum
Posts: 26
Joined: Wed Sep 23, 2015 2:58 pm
Operating System: Windows 10

Invalid character number + Open' command to open...

Post by Kalum » Sat Apr 01, 2017 6:05 pm

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="&#xd83c;&#xdfa7; 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
Attachments
The RP_Episode 20_Part 1-3_V1.aup
File before attempt to fix with notepad
(253.79 KiB) Downloaded 22 times

Kalum
Posts: 26
Joined: Wed Sep 23, 2015 2:58 pm
Operating System: Windows 10

Re: Invalid character number + Open' command to open...

Post by Kalum » Sat Apr 01, 2017 6:16 pm

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 "&#xd83c;&#xdfa7;" bit appearing as part of the file name (two places) in the code when opening the aup with Wordpad :(

Kalum
Posts: 26
Joined: Wed Sep 23, 2015 2:58 pm
Operating System: Windows 10

Re: Invalid character number + Open' command to open...

Post by Kalum » Sat Apr 01, 2017 6:25 pm

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.

:?

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Invalid character number + Open' command to open...

Post by Gale Andrews » Sun Apr 02, 2017 1:15 pm

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
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Invalid character number + Open' command to open...

Post by Edgar » Sun Apr 02, 2017 4:02 pm

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-->
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Invalid character number + Open' command to open...

Post by Gale Andrews » Mon Apr 03, 2017 1:29 pm

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
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Post Reply