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

Today when I opened the .aup file of my latest episode I get the following:

[quote]Error: reference to invalid character number at line 57.[/quote]

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

[quote]<wavetrack name=“&#xd83c;&#xdfa7; Campfire On The beach Ambience - 8 Hours Relaxing Ocean Wave Sounds Calming Crackling Fire Sound” [/quote]


After doing that and saving in Notepad, when double clicking the .aup file to open it I have the following message:

[quote]“file name” is an audacity project file. Use the ‘File > Open’ command to open Audacity Projects.[/quote]

Anyone could help / knows what I’m doing wrong? :frowning:



Thanks in advance for your help.



FYI my PC is Win10

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 :frowning:

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.

:confused:

Thanks for following up.

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

google:
windows notepad always utf
and look at:
https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/default-utf-8-encoding-for-new-notepad-documents/525f0ae7-121e-4eac-a6c2-cfe6b498712c
or:

there is a YouTube video:

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" ?> [...stuff removed...]

This another app’s similar file (also truncated):

<?xml version="1.0" encoding="utf-8"?>

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