Search code examples
wixwindows-installer

WIX How to include the equal signs and ampersand in the string table to avoid LGHT0104 error


I have a launch condition error string in String_en-US.wxl:

<WixLocalization Culture="en-us" Codepage="1252" xmlns="http://schemas.microsoft.com/wix/2006/localization">
    <String Id="ERR_REQUIRED_APP_ABSENT">This product requires XXX to be on the system. Please download it from "https://knowledge.xxx.com/knowledge/llisapi.dll?func=ll&objId=59284919&objAction=browse&sort=name&viewType=1", install it and try again.</String>
</WixLocalization>

It seems having the ampersand signs (&) and the equal signs (=) cause the light error:

Strings_en-US.wxl(0,0): error LGHT0104: Not a valid localization file; detail: '=' is an unexpected token. The expected token is ';'. Line 36, position 172.

I even tried to escape them using &#61; which is equivalent to the equal sign but it complaint about the ampersand. "How can I avoid the error?


Solution

  • CDATA: A CDATA section is "...a section of element content that is marked for the parser to interpret as only character data, not markup."

    In this case, something like this:

    <String Id="TEST1"><![CDATA[https://www.hi.com/one&two&three&v=1]]></String>
    

    XML Escape Characters: XML escape characters are normally used for encoding special characters in XML documents. The escape character for & is & &amp; (more) - CDATA is an alternative approach.


    Links: