+@@ -42,20 +45,21 @@
+ {
+ u_char c, nib;
+ u_int len = 0;
++ locale_t loc = __current_locale();
+
+ while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
+ if (c == '.' || c == '+' || c == '/')
+ continue;
+ if (!isascii(c))
+ return (0);
+- if (islower(c))
+- c = toupper(c);
+- if (isxdigit(c)) {
++ if (islower_l(c, loc))
++ c = toupper_l(c, loc);
++ if (isxdigit_l(c, loc)) {
+ nib = xtob(c);
+ c = *ascii++;
+ if (c != '\0') {
+- c = toupper(c);
+- if (isxdigit(c)) {
++ c = toupper_l(c, loc);
++ if (isxdigit_l(c, loc)) {
+ *binary++ = (nib << 4) | xtob(c);
+ len++;
+ } else
+@@ -78,9 +82,14 @@