Jump to content
Sign in to follow this  
LecLightning56

Incorrect character encoding in add-ons.cfg file

Recommended Posts

When I check for encoding errors in P4AO, I get a message identifying an incorrect character encoding in C:\ProgramData\Lockheed Martin\Prepar3D v4\add-ons.cfg file.

Is this normal and can it ignored?

Share this post


Link to post
Share on other sites
4 hours ago, LecLightning56 said:

When I check for encoding errors in P4AO, I get a message identifying an incorrect character encoding in C:\ProgramData\Lockheed Martin\Prepar3D v4\add-ons.cfg file.

Is this normal and can it ignored?

Yes, you can usually ignore it. The message should be gone when you press "Save" in P4AO.

Best regards


LORBY-SI

Share this post


Link to post
Share on other sites
On 2/18/2019 at 12:42 PM, Lorby_SI said:

Yes, you can usually ignore it. The message should be gone when you press "Save" in P4AO.

Best regards

Mine doesn't. Actually never happened before until these days. How can I fix it? Thanks!


Best regards,

Wanthuyr Filho

Instagram: AeroTacto

Share this post


Link to post
Share on other sites
2 hours ago, Wanthuyr Filho said:

Mine doesn't. Actually never happened before until these days. How can I fix it? Thanks!

As long as your simulator works, you don't have to fix it.

These things usually happen when a non-spec installer or a user manipulates the add-on.cfg files directly using unsuitable means. Those files are not to be tampered with. The proper way to make P3D aware of a new addon is to either use the P3D CLI as described in detail in the Learning Center, or the P3D Autodiscovery folder in \Documents.

btw:

CFG files have to be encoded in UTF-16 (UCS-2 LE BOM in Notepad++) There was a sticky thread to that effect in the Prepar3D subforum once, but it has disappeared now.

Best regards

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites
On 3/16/2019 at 8:37 AM, Lorby_SI said:

CFG files have to be encoded in UTF-16 (UCS-2 LE BOM in Notepad++) There was a sticky thread to that effect in the Prepar3D subforum once, but it has disappeared now.

Hi Oliver,

This doesn't seem to be the case in P3D v5 anymore. I changed a number of xmls to UTF-16 and P3D simply didn't load them. I changed them back and they worked again. Perhaps it would make sense to rethink the warning message or question the usefulness of the "check encoding" feature.


Kind regards,

Alan

Share this post


Link to post
Share on other sites

 

21 minutes ago, AlanB77L said:

Hi Oliver,

This doesn't seem to be the case in P3D v5 anymore. I changed a number of xmls to UTF-16 and P3D simply didn't load them. I changed them back and they worked again. Perhaps it would make sense to rethink the warning message or question the usefulness of the "check encoding" feature.

My post was about CFG files, not XML. The XML files are a completely different story. When you play around with the encoding of XML files, be mindful of the text declaration. It should always match the actual encoding, or a parser might refuse to read the file. P4AO will create all XML files in UTF-8 BOM, and add a matching text declaration.

Please check the XML specification here:

https://www.w3.org/TR/xml/#TextEntities
Section 4.3.1 and 4.3.3

The point of the warning message is, that a user or a program, for example a legacy FSX installer, can effectively DESTROY a CFG or XML file if he or it is unaware of the character encoding.

Best regards

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Hi Oliver,

Sorry, I searched for "encoding" and didn't even pay attention to the file type. P4AO still gives says the addons.cfg has a wrong encoding, so I can apply the UTF-16 there then.

As far as the addon.xml files are concerned, I assume hitting save in P4AO corrects them to UTF-8 BOM automatically, as those that appeared in the earlier listing are now encoded that way.

 


Kind regards,

Alan

Share this post


Link to post
Share on other sites
10 minutes ago, AlanB77L said:

P4AO still gives says the addons.cfg has a wrong encoding

The issue here is not that the encoding is wrong. It is why that happened in the first place. "Something" didn't know what it was doing, and that can come back to bite you.

P4AO does not alter files, it always makes a copy of the original and then writes a new one. That is why XML files revert to proper encoding and text declaration when you press "Save". Can't do that for CFG files though, that can go wrong - hence the warning message. When you change the encoding and suddenly you see only jumbled up character garbage, you can just undo the change (as long as you didn't save the file). A program wouldn't care and just proceed.

Best regards 

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Thanks for the clarification Oliver. I should check the warnings more often to narrow down the culprit. The addons.cfg should only be written by P3D itself and I assume it would encode it properly.

Edited by AlanB77L

Kind regards,

Alan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...