summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-03-16 13:57:00 -0600
committerKarl Williamson <khw@cpan.org>2018-03-16 14:09:42 -0600
commit6726b4f40a8baa55f93e1dc39b22e799d43bd9d0 (patch)
treeac775874917bcd4b9ee29398dcac52dda7d491c0 /locale.c
parentf0023d47ed03cb97a4ad1075a2a56663063fa641 (diff)
downloadperl-6726b4f40a8baa55f93e1dc39b22e799d43bd9d0.tar.gz
locale.c: Clarify warning message
When there are discrepancies in the locale and what Perl is expecting, a warning is raised listing the problematic characters. For \n, and \t, they should have been displayed as mnemonics, but a required backslash to escape things had been omitted, so they were displayed literally, so looked just like white space. Also, put any displayed blank in ' ' so it won't look like the list is empty.
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/locale.c b/locale.c
index 7a0cd74104..cb5992938e 100644
--- a/locale.c
+++ b/locale.c
@@ -1548,18 +1548,22 @@ S_new_ctype(pTHX_ const char *newctype)
&& (isGRAPH_A(i) || isBLANK_A(i) || i == '\n'))
{
bool is_bad = FALSE;
- char name[3] = { '\0' };
+ char name[4] = { '\0' };
/* Convert the name into a string */
- if (isPRINT_A(i)) {
+ if (isGRAPH_A(i)) {
name[0] = i;
name[1] = '\0';
}
else if (i == '\n') {
- my_strlcpy(name, "\n", sizeof(name));
+ my_strlcpy(name, "\\n", sizeof(name));
+ }
+ else if (i == '\t') {
+ my_strlcpy(name, "\\t", sizeof(name));
}
else {
- my_strlcpy(name, "\t", sizeof(name));
+ assert(i == ' ');
+ my_strlcpy(name, "' '", sizeof(name));
}
/* Check each possibe class */