The new
WebTopicCreator in 4.0.0 has some
JavaScript in the input field for the page name that looks like it is trying to deal with mapping non-ASCII (ISO8859-Latin1?) characters to ASCII near-equivalents. Unfortunately, it has the side effect of removing some perfectly valid topic name characters, such as numbers. The original
JavaScript looks like this (this was originally all on one line, but I formatted it on multiple lines to make it easier to follow the code):
onBlur="
var sIn = this.value;
var sOut = '';
var chgUpper = true;
for ( var i = 0; i < sIn.length; i++ ) {
var ch = sIn.charAt( i );
var ch2 = '';
if((ch=='à')
||(ch=='á')
||(ch=='â')
||(ch=='ã')
||(ch=='å') ) {
ch = 'a';
}
if( (ch=='è')||(ch=='é')||(ch=='ê') ) {
ch = 'e';
}
if( ch=='ç') {
ch = 'c';
}
if( ch=='ñ') {
ch = 'n';
}
if( (ch=='ò')||(ch=='ó')||(ch=='ô') ) {
ch = 'o';
}
if( ch=='ä') {
ch = 'a';
ch2 = 'e';
}
if( ch=='ö') {
ch = 'o';
ch2 = 'e';
}
if( (ch=='ù')||(ch=='ú')||(ch=='û') ) {
ch = 'o';
}
if( ch=='ü') {
ch = 'u';
ch2 = 'e';
}
if( ch=='Ä') {
ch = 'A';
ch2 = 'e';
}
if( ch=='Ö') {
ch = 'O';
ch2 = 'e';
}
if( ch=='Ü') {
ch = 'U';
ch2 = 'e';
}
if( ch=='ß') {
ch = 's';
ch2 = 's';
}
if( ((ch>='a')&&(ch<='z')) || ((ch>='A')&&(ch<='Z')) ) {
if( chgUpper ) {
ch = ch.toUpperCase();
chgUpper = false;
}
sOut+=ch;
if( ch2!='') {
sOut+=ch2;
}
} else {
if( ch==' ' ) {
chgUpper = true;
}
}
}
this.form.topic.value=sOut;"
I think it should be changed to something more like this:
onBlur="
var sIn = this.value;
var sOut = '';
var chgUpper = true;
for ( var i = 0; i < sIn.length; i++ ) {
var ch = sIn.charAt( i );
var ch2 = '';
if((ch=='à')
||(ch=='á')
||(ch=='â')
||(ch=='ã')
||(ch=='å') ) {
ch = 'a';
}
if( (ch=='è')||(ch=='é')||(ch=='ê') ) {
ch = 'e';
}
if( ch=='ç') {
ch = 'c';
}
if( ch=='ñ') {
ch = 'n';
}
if( (ch=='ò')||(ch=='ó')||(ch=='ô') ) {
ch = 'o';
}
if( ch=='ä') {
ch = 'a';
ch2 = 'e';
}
if( ch=='ö') {
ch = 'o';
ch2 = 'e';
}
if( (ch=='ù')||(ch=='ú')||(ch=='û') ) {
ch = 'o';
}
if( ch=='ü') {
ch = 'u';
ch2 = 'e';
}
if( ch=='Ä') {
ch = 'A';
ch2 = 'e';
}
if( ch=='Ö') {
ch = 'O';
ch2 = 'e';
}
if( ch=='Ü') {
ch = 'U';
ch2 = 'e';
}
if( ch=='ß') {
ch = 's';
ch2 = 's';
}
if( ((ch>='a')&&(ch<='z')) || ((ch>='A')&&(ch<='Z')) ) {
if( chgUpper ) {
ch = ch.toUpperCase();
chgUpper = false;
}
}
sOut+=ch;
if( ch2!='') {
sOut+=ch2;
}
if( ch==' ' ) {
chgUpper = true;
} else {
chgUpper = false;
}
}
this.form.topic.value=sOut;"
The change is right at the end. The current code will only keep (mapped) characters within the range A-Za-z, because the
sOut+=ch;
line is controlled by that if statement. Adding the characters into the result needs to be outside of that if, as shown in the proposed correction.
I made one other small change, too. Where it checks for a space and then sets the
chgUpper
flag, I set it to
false
if the character just added was not a space. Without this change, if the user enters a page name like
Meeting minutes 2006x02x06
, this gets changed to
MeetingMinutes2006X02x06
--- note that the "x" after "2006" got changed to upper case. With the change, it will be rendered as
MeetingMinutes2006x02x06
(i.e., lower case "x" after "2006"), which I think is more likely to be what was wanted.
Thank you for this suggestion, David, much better now!
SVN 8996, tagged for 4.0.2.
--
SP
Thinking about this, as with Dakar all kinds of
I18N topics will be linked pr. default,
I18N-stuff should really also be allowed pr default in topics created with the creator.
(See
DanishCharsÆØÅ for a "demo" - develop doesn't run a danish locale).
SVN 9321, Develop + TWiki4.
--
SP
Closed with 4.0.2 release
KJL