Peter Loft wrote:
If I change the stylesheet so that the default value of 'parameterName'
corresponds to the Japanese string passed in and then run this via
Visual Studio then everything works fine.
I could be getting this wrong on so many levels so any help would be
appreciated.
The code you showed seems like ATL or COM C++ code to me. That's been a
while ;)
To get international characters correctly one should adhere to the rule
of getting them correctly everywhere. The MSXML libraries you use give
you the opportunity to set the character set before reading your
streams. IIRC, Microsoft overrides the character set (better: character
encoding) defined in the XML prologue, meaning it is best to set it
yourself.
Same is true for the XSLT, which is XML. The XSLT must be loaded as
UTF-8 (or similar) if it contains high characters. Since Microsoft's
MSXML (and any other processor for that matter) loads the XSLT through
an XML parser, this parser must load it with UTF-8. Check if that is
correct.
Finally, when you have the source and the XSLT correct, the output
settings must be correct. But that won't influence your processing, it
only influences the way the output will be encoded. I.e., if the output
is XML and you specify US-ASCII as encoding, then all high characters
(meaning above 0x7F) will be escaped using numerical entity references.
Finally (2), if you write your output XML somewhere, using XML
streaming, this receptive stream must also have the correct encoding set
before it is used / attached to the processor.
It is been some time since I used MSXML from code, but I remember having
some trouble getting encoding correct. To test your chain, create a
minimalist XSLT template, an XML input stream, and an output stream and
run it with high characters. When it works and all settings are as they
should, then add your original stylesheet and source.
I believe it is also possible to tell the output stream to use whatever
encoding the XSLT says it should use, but I believe I have never managed
that the normal way (with "normal" I mean automatically). So make sure
to explicitly set it until you find a better method.
HTH,
Cheers,
-- Abel