- os << "\\usepackage[";
- std::copy(encodings.begin(), encodings.end(),
- std::ostream_iterator<string>(os, ","));
- os << doc_encoding << "]{inputenc}\n";
- texrow.newline();
- } else if (inputenc != "default") {
- os << "\\usepackage[" << inputenc
+ // thailatex does not use the inputenc package, but sets up
+ // babel directly for tis620-0 encoding, therefore we must
+ // not request inputenc for tis620-0 encoding
+ if (!encodings.empty() || doc_encoding != "tis620-0") {
+ os << "\\usepackage[";
+ std::set<string>::const_iterator it = encodings.begin();
+ std::set<string>::const_iterator const end = encodings.end();
+ if (it != end) {
+ os << from_ascii(*it);
+ ++it;
+ }
+ for (; it != end; ++it)
+ os << ',' << from_ascii(*it);
+ if (doc_encoding != "tis620-0") {
+ if (!encodings.empty())
+ os << ',';
+ os << from_ascii(doc_encoding);
+ }
+ os << "]{inputenc}\n";
+ texrow.newline();
+ }
+ } else if (inputenc != "default" && inputenc != "tis620-0" &&
+ inputenc != "ascii") {
+ os << "\\usepackage[" << from_ascii(inputenc)