32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
diff -ruN taglib-1.4.org/taglib/toolkit/tstring.cpp taglib-1.4/taglib/toolkit/tstring.cpp
|
|
--- taglib-1.4.org/taglib/toolkit/tstring.cpp 2005-07-26 06:31:15.000000000 +0900
|
|
+++ taglib-1.4/taglib/toolkit/tstring.cpp 2006-05-26 12:02:55.000000000 +0900
|
|
@@ -202,12 +202,22 @@
|
|
s.resize(d->data.size());
|
|
|
|
if(!unicode) {
|
|
- std::string::iterator targetIt = s.begin();
|
|
- for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
|
- *targetIt = char(*it);
|
|
- ++targetIt;
|
|
+ bool cjk = false;
|
|
+ //pre-scan: is there any cjk unicode character? if so, convert the string into utf-8.
|
|
+ for(unsigned int i=0; i< d->data.size(); i++){
|
|
+ if(d->data[i] > 0xff){
|
|
+ cjk = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if(!cjk){
|
|
+ std::string::iterator targetIt = s.begin();
|
|
+ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
|
+ *targetIt = char(*it);
|
|
+ ++targetIt;
|
|
+ }
|
|
+ return s;
|
|
}
|
|
- return s;
|
|
}
|
|
|
|
const int outputBufferSize = d->data.size() * 3 + 1;
|