When no iocharset is specified, the default action is to trivially
map each byte into the low order of the 16-bit unicode character.
If an existing name exists that has a non-zero high order byte, the
file will be inaccessible without remounting with iocharset set to
a charset that supports the character.
This patch will cause a warning to be issued to the syslog (no more
than five times) suggesting that the volume be mounted with
iocharset=utf8 in order to access the file.
{
int i;
int outlen = 0;
+ static int warn_again = 5; /* Only warn up to 5 times total */
+ int warn = !!warn_again; /* once per string */
if (codepage) {
for (i = 0; (i < len) && from[i]; i++) {
to[outlen++] = '?';
}
} else {
- for (i = 0; (i < len) && from[i]; i++)
- to[i] = (char) (le16_to_cpu(from[i]));
+ for (i = 0; (i < len) && from[i]; i++) {
+ if (le16_to_cpu(from[i]) & 0xff00) {
+ if (warn) {
+ warn--;
+ warn_again--;
+ printk(KERN_ERR
+ "non-latin1 character 0x%x found in JFS file name\n",
+ le16_to_cpu(from[i]));
+ printk(KERN_ERR
+ "mount with iocharset=utf8 to access\n");
+ }
+ to[i] = '?';
+ }
+ else
+ to[i] = (char) (le16_to_cpu(from[i]));
+ }
outlen = i;
}
to[outlen] = 0;