summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--string.c20
2 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3067865ea9..1f4c7ae15f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Feb 5 18:20:30 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_upcase_bang): multi byte character support.
+
Wed Feb 4 13:55:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* array.c (ary_reverse): SEGV on empty array reverse.
diff --git a/string.c b/string.c
index 8c5b4eb76b..aea64dff0b 100644
--- a/string.c
+++ b/string.c
@@ -1397,7 +1397,10 @@ str_upcase_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
while (s < send) {
- if (islower(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (islower(*s)) {
*s = toupper(*s);
}
s++;
@@ -1422,7 +1425,10 @@ str_downcase_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
while (s < send) {
- if (isupper(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (isupper(*s)) {
*s = tolower(*s);
}
s++;
@@ -1449,7 +1455,10 @@ str_capitalize_bang(str)
if (islower(*s))
*s = toupper(*s);
while (++s < send) {
- if (isupper(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (isupper(*s)) {
*s = tolower(*s);
}
}
@@ -1472,7 +1481,10 @@ str_swapcase_bang(str)
str_modify(str);
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
while (s < send) {
- if (isupper(*s)) {
+ if (ismbchar(*s)) {
+ s++;
+ }
+ else if (isupper(*s)) {
*s = tolower(*s);
}
else if (islower(*s)) {