aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-12-31 17:46:09 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-01-02 21:30:21 -0800
commit7f0cc7748359bba34797ba9f6833820157ec407b (patch)
tree6b36ec7950ac996f87662d885d26d74b90a7f4b1 /src/core/basetypes
parent39bc44d7160253009c92b8a1b926f46708eaee55 (diff)
Improved charset conversion. Added TODOs.
Diffstat (limited to 'src/core/basetypes')
-rw-r--r--src/core/basetypes/MCData.cc7
-rw-r--r--src/core/basetypes/MCString.cc2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/core/basetypes/MCData.cc b/src/core/basetypes/MCData.cc
index f8ca7e70..964f7b11 100644
--- a/src/core/basetypes/MCData.cc
+++ b/src/core/basetypes/MCData.cc
@@ -263,14 +263,14 @@ String * Data::stringWithDetectedCharset(String * hintCharset, bool isHTML)
charset = normalizeCharset(charset);
- /*
+ // Remove whitespace at the end of the string to fix conversion.
if (charset->isEqual(MCSTR("iso-2022-jp-2"))) {
const char * theBytes;
Data * data;
theBytes = bytes();
data = this;
- if (length() > 0) {
+ if (length() >= 2) {
unsigned int idx;
idx = length();
@@ -291,8 +291,7 @@ String * Data::stringWithDetectedCharset(String * hintCharset, bool isHTML)
return result;
}
- */
-
+
result = stringWithCharset(charset->UTF8Characters());
if (result == NULL) {
result = stringWithCharset("iso-8859-1");
diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc
index d99931b6..26e2f931 100644
--- a/src/core/basetypes/MCString.cc
+++ b/src/core/basetypes/MCString.cc
@@ -1817,6 +1817,7 @@ bool String::hasPrefix(String * prefix)
String * String::lastPathComponent()
{
+ // TODO: Improve Windows compatibility.
UChar * component = u_strrchr(mUnicodeChars, '/');
if (component == NULL)
return (String *) this->copy()->autorelease();
@@ -1911,6 +1912,7 @@ String * String::stringWithFileSystemRepresentation(const char * filename)
String * String::stringByAppendingPathComponent(String * component)
{
+ // TODO: Improve Windows compatibility.
String * result = (String *) this->copy()->autorelease();
if (result->length() > 0) {
UChar lastChar = result->unicodeCharacters()[result->length() - 1];