invalid character error

  • Thread starter Thread starter Anna Carr
  • Start date Start date
A

Anna Carr

I had a project which was working until this morning and I
keep getting the following error. Does anyone know what
has happened and how I can fix it??

error message - There is an invalid character in the given
encoding. Line 1, position 1.

line highlighted in red = this.LoadLayout(this.GetType
(), "Causeway_Reports.ForensicEvidenceDetails.rpx");
 
Hi Anna,

I haven't had this error before, but the error points to line 1, position 1.
From the error message I suspect that the character in the first position is some extended or unicode character.

If you don't see anything out of the ordinary on line 1, try deleting the entire line and then rewrite it (not copy and paste).

The line highlighted in red is probably related to some other error.
 
By the fact that this is an RPX file, I assume we are talking about crystal
reports. and that this is an XML based report layout file.

Did you open your XML file in Visual Studio? If so, did you change the
encoding (from UTF8 to UTF16)? This rarely works well. I've had
situations where Visual Studio would refuse to open the file again, unless
you specify a different editor to open it with.

First, check to see if you can open your file with Notepad. Notepad is
actually pretty sophisticated at dealing with encoding. If you can, take a
look in the first line of the XML to see if the encoding is listed as UTF16.
If so, you will need to set it back. Here's how:

Open Visual Studio. Make sure that your RPX file is in your project.
In the solution explorer, right-click the file and say Open With
In the list of editors, chose "XML editor with encoding"
when the dialog appears asking for "which encoding", leave "auto-detect" and
click Open.

you should get the file to open.

Then, select the file again in the solution explorer. Look at the
properties. You should see the encoding. Click the encoding property to
expose the drop-down. Select UTF8.

Save your file.

Good Luck,
---- Nick
 
Back
Top