30 lines
1007 B
Diff
30 lines
1007 B
Diff
Fix set_encoding() to understand C.UTF-8 and other
|
|
locale names with != 5 characters before .
|
|
|
|
--- src/mbchar.c 2008-03-08 11:06:13.000000000 -0200
|
|
+++ src/mbchar.c 2020-01-13 10:02:20.800174591 -0300
|
|
@@ -366,6 +366,7 @@
|
|
= "Too long encoding name: %s%.0ld%.0s"; /* _E_ */
|
|
const char * loc = "";
|
|
int alias;
|
|
+ char *dot;
|
|
char norm[ NAMLEN];
|
|
/*
|
|
* Normalized name (removed 'xxxxx.', stripped '_', '-', '.'
|
|
@@ -380,10 +381,11 @@
|
|
mcpp_fputc( '\n', ERR);
|
|
}
|
|
}
|
|
- strcpy( norm, name);
|
|
- if (norm[ 5] == '.')
|
|
- memmove( norm, norm + 5, strlen( norm + 5) + 1);
|
|
- /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.' or any other */
|
|
+ if ( dot = strchr( name, '.' ) )
|
|
+ /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.', 'C.' or any other */
|
|
+ strcpy( norm, dot+1);
|
|
+ else
|
|
+ strcpy( norm, name);
|
|
conv_case( norm, norm + strlen( norm), LOWER);
|
|
strip_bar( norm);
|
|
|