The property
TaminoPreference.RequiredEncoding
specifies to the
Tamino XML Server the encoding to be used when returning a retrieved document
or a query response. This is useful for programmers who wish to deal with
documents in some encoding (for example, EUC-JP) other than the default
encoding (UTF-8). Note that the encoding is only apparent at the byte stream
level, i.e. if a document is stored to a file or is read as a stream. It is not
apparent in a DOM tree, as the document appears as Unicode. The encoding would
also appear in the XML document prolog (for example, encoding="EUC-JP").
... // create preferences for EUC-JP TaminoPreference pref = new TaminoPreference(); pref.RequiredEncoding = "EUC-JP"; // create connection with preferences TaminoConnection connection = new TaminoConnection("http://localhost/tamino/mydb", pref); connection.Open(TaminoConnectionMode.AutoCommit); // create command TaminoCommand command = connection.CreateCommand(); // retrieve document in EUC-JP encoding Stream stream = command.RetrieveStream(someUri); // write stream to console Console.Write("EUC-JP: "); for (int b=stream.ReadByte() ; b != -1 ; b=stream.ReadByte()) { Console.Write(b.ToString("X2")+","); } Console.WriteLine(); ...