Permalink
Browse files

[BUGFIX] issue 194: make default encoding UTF-8

  • Loading branch information...
1 parent 34a7389 commit d78b1e1f5e6673e8abf28ecd7c376a3871066c31 @execjosh execjosh committed Aug 21, 2011
Showing with 11 additions and 1 deletion.
  1. +10 −1 src/encoding.cpp
  2. +1 −0 src/encoding.h
View
11 src/encoding.cpp
@@ -32,7 +32,14 @@
Encoding::Encoding()
{
- m_codec = QTextCodec::codecForLocale();
+ QTextCodec *codec = QTextCodec::codecForName(DEFAULT_CODEC_NAME);
+
+ // Fall back to locale codec
+ if ((QTextCodec *)NULL == codec) {
+ codec = QTextCodec::codecForLocale();
+ }
+
+ m_codec = codec;
}
Encoding::Encoding(const QString &encoding)
@@ -85,3 +92,5 @@ QTextCodec *Encoding::getCodec() const
return codec;
}
+
+const QByteArray Encoding::DEFAULT_CODEC_NAME = "UTF-8";
View
1 src/encoding.h
@@ -52,6 +52,7 @@ class Encoding
QTextCodec *getCodec() const;
QTextCodec *m_codec;
+ static const QByteArray DEFAULT_CODEC_NAME;
};
#endif // ENCODING_H

0 comments on commit d78b1e1

Please sign in to comment.