0

I am using msxsl.exe to generate HTML file dynamically from an XML and XSL. I have written the code in C++ using CreateProcess API and calling msxsl.exe in that. Since the output was UTF8 in Windows 7, I created all associated files(like CSS and JavaScript) in same encoding. Everything was working fine. When I am running the same application in Windows 10 (LTSC), the JavaScript was not loaded as the HTML is now generated with UCS-2LE BOM encoding. I tried calling SetConsoleOutputCP(CP_UTF8) just before creating the process. This didn't solved my issue. How could I get the UTF8 output irrespective of the OS?

MGR
  • 313
  • 3
  • 14

2 Answers2

2

Add

<xsl:output encoding="UTF-8" /> 

to the stylesheet passed to msxsl.exe

PrecisionLex
  • 801
  • 11
  • 26
0

HTML files accept JavaScript with same encoding as the HTML file itself. This is the default behavior. When using JavaScript with another encoding, the charset attribute of <script> tag can be used(HTML script charset Attribute).

So adding charset attribute like shown below I could fix the type of JavaScript in all OS, irrespective of the HTML encoding.

<script type="text/javascript" src="MyJavaScript.js" charset="UTF-8"></script>

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
MGR
  • 313
  • 3
  • 14