1

Topic: XSLT from a file with the wrong coding

Good afternoon!
At me on an input xml files without coding instructions, i.e. utf-8. In a file the Russian text in a type  to see it is normally necessary to lead code conversion from utf-8 in iso-8815-1 from to consider as windows-1251.
It is necessary to receive from them different documents with the normal text means xslt.
Candidate solutions:
1. For obtaining html, it is possible to use a blende in xsl:

<? xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "xml" indent = "yes" encoding = "ISO-8859-1" omit-xml-declaration = "yes"/>
<xsl:template match = "/">
<html>
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset=win-1251"/>
...

Badly also it is necessary not only html.
2. Beforehand to lead double code conversion of source files by exterior means of type iconv, but here complexities with an infrastructure.
3. XSL I know badly and someone prompts me other way means most xsl versions 1.0.

2

Re: XSLT from a file with the wrong coding

I recommend simply any script adds in source files coding instructions.
For example, the code on JScript

var fso = new ActiveXObject ("Scripting. FileSystemObject");
var fileName = WScript. Arguments. Item (0);
var fileStrm = fso. OpenTextFile (fileName, 1);
var s = fileStrm. ReadAll ();
fileStrm. Close ();
s = s.replace (/^ \<\? xml. +? \? \>/, "<? xml version =" 1.0"encoding ="windows-1251"?>");
fileStrm = fso. CreateTextFile (fileName);
fileStrm. Write (s);
fileStrm. Close ();

3

Re: XSLT from a file with the wrong coding

_Vasilisk _;
So does not go with initial a file, that coding, there double recoding there is simply specified: in an example with xsl there is a recoding from utf-8 in iso-8859-1 and the title xml is passed, and in  it is told that windows-1251 - then the result is displayed correctly. So it is possible with result xsl conversions to arrive, but it would be desirable not to produce handlings.
Apparently there was only 2 variant, as the most correct.

4

Re: XSLT from a file with the wrong coding

shurik05 wrote:

there double recoding

It as? In a file two various codings are used? Can put a file?

5

Re: XSLT from a file with the wrong coding

6

Re: XSLT from a file with the wrong coding

7

Re: XSLT from a file with the wrong coding

8

Re: XSLT from a file with the wrong coding

To avoid different interpretations of codings I will show in HEX: C3 84 C3 A0 C3 B2 C3 A0.