Page Index Toggle Pages: 1
Topic Tools
Normal Topic [Serious] Display Name in UTF-8 characters (Read 10,714 times)
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: [Serious] Display Name in UTF-8 characters
Reply #9 - Aug 3rd, 2010 at 8:49pm
Post Tools
thnx. Works.

New
cgi-bin/yabb2/Admin/Admin.pl
cgi-bin/yabb2/Sources/Load.pl
cgi-bin/yabb2/Sources/Profile.pl
cgi-bin/yabb2/Sources/Register.pl

public_html/yabbfiles/ajax.js

in CVS.
« Last Edit: Aug 3rd, 2010 at 8:50pm by Jet Li »  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
Carsten
Ex Member


Re: [Serious] Display Name in UTF-8 characters
Reply #8 - Aug 3rd, 2010 at 8:28pm
Post Tools
In Admin.pl find:

Code
Select All
	&ToChars($member{'regrealname'}); 



and replace it with:

Code
Select All
	$member{'regrealname'} = $convertstr; 



------------------

In Load.pl find:

Code
Select All
		&FormatUserName($user);
		&LoadMiniUser($user);

		return 1;
	} 



and add before:

Code
Select All
		&ToChars(${$uid.$user}{'realname'}); 



------------------

In Profile.pl find:

Code
Select All
			&ToHTML($member{'name'});
			&ToChars($member{'name'});

			&fatal_error("invalid_character","$profile_txt{'68'} $profile_txt{'241re'}") if $member{'name'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/; 



and replace it with:

Code
Select All
			&fatal_error("invalid_character","$profile_txt{'68'} $profile_txt{'241re'}") if $member{'name'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;

			&ToHTML($member{'name'}); 



------------------

In Register.pl find:

Code
Select All
	&ToChars($member{'regrealname'}); 



and replace it with:

Code
Select All
	$member{'regrealname'} = $convertstr; 



------------------

In ajax.js find:

Code
Select All
function checkAvail(scripturl,val,type) { 



and add after:

Code
Select All
	var valstr = '';
	for (i = 0; i < val.length; i++) {
		if (val.charCodeAt(i) > 127) valstr += '[ch' + val.charCodeAt(i) + ']';
		else valstr += val.charAt(i);
	}
	var urivalstr = encodeURIComponent(valstr); 



then find:

Code
Select All
	xmlHttp.open("GET", scripturl + "?action=checkavail;type=" + type + ";" + type + "=" + val, true); 



and replace it with:

Code
Select All
	xmlHttp.open("GET", scripturl + "?action=checkavail;type=" + type + ";" + type + "=" + urivalstr, true); 




Been tested "leight" - extra testing is always good  Smiley
« Last Edit: Aug 3rd, 2010 at 8:35pm by »  
Back to top
 
IP Logged
 
Matt Siegman
YaBB Legends (Inactive)
*
Offline



Posts: 3,380
Location: Wichita, KS
Re: [Serious] Display Name in UTF-8 characters
Reply #7 - May 8th, 2010 at 10:01pm
Post Tools
I'm going to guess that the ToChars subroutine is causing this. The problem is that something like that may be code that sanitizes names for displays.

Non-ASCII characters are converted to [ch####] internally (not sure why, Perl should support Unicode just fine) and then converted to &#####; on display.

We probably should figure this out, it would affect any non-English board.
  

-- Matt Siegman 8) Wish List
Back to top
 
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 3,811
Location: Land of the Blazing Sun!

YaBB 2.6.0
Re: Display Name in UTF-8 characters
Reply #6 - Oct 16th, 2009 at 12:37am
Post Tools
Well UK

It looks like your very straight-forward answer may have pointed the way to a fix. (or at least part of the way)



Although I am NOT a developer here, I have isolated at least part of the problem. I will leave it to those who know the code completely to resolve the rest of the issues.

The invalid character problem lies in this Register.pl code (and wherever else this snip is used):

Version 2.4

Code
Select All
&FromChars($member{'regrealname'});
	$convertstr = $member{'regrealname'};
	$convertcut = 30;
	&CountChars;
	&ToChars($member{'regrealname'});
	&fatal_error("realname_to_long","($member{'regrealname'} => $convertstr)") if $cliped;
	&fatal_error('invalid_character', "$register_txt{'38'} $register_txt{'241re'}") if $member{'regrealname'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;
 



Version 2.3.1
Code
Select All
&FromChars($member{'regrealname'});
	$convertstr = $member{'regrealname'};
	$convertcut = 30;
	&CountChars;
	$member{'regrealname'} = $convertstr;
	&fatal_error("name_too_long") if $cliped;

	&fatal_error('invalid_character', "$register_txt{'38'} $register_txt{'241re'}") if $member{'regrealname'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;
 



Substituting the 2.3.1 code snippet will allow registering BIG5 coded displaynames aka 'realname'.

But the display problem remains. 

As does the problem with maintaining the displaynames.  Using the User Control Panel will draw the 'old' invalid character problem, so I 'guess' the devs used the same code snippet in multiple subs, rather than having a call to a single validation routine. 

As I don't know all the places to apply a patch, I will bow to the experts.  I surely would miss some and you would be no better off.

Edited:
In Profile.pl, the code functionality is different, although the same error is displayed.


Good Luck
Smiley

Its a bug for sure -    where's the Deti bug spray?
« Last Edit: Oct 16th, 2009 at 12:59am by JonB »  

I find your lack of faith disturbing.
Back to top
IP Logged
 
UK
YaBB Newcomer
*
Offline



Posts: 11
Re: Display Name in UTF-8 characters
Reply #5 - Oct 15th, 2009 at 10:53pm
Post Tools
- YES, they can change their display name

- They can ALWAYS change their display name, even now; However, if the Display name is in UTF-8 characters, they won't display probably.

- BIG5 characters will display as [ch25109][ch26459][ch39324][ch28204][ch20254][ch26899][ch22218], which makes completely no sense.

- The previous version (2.3.1) was fine, this version (2.4.0) causes this problem, even with a clean install.

It's a very straight-forward situation, try not to make it too complicated.

Just do a simply test, try to type (not copy and paste) [ch25105] am testing, it means "I am testing" in BIG5, "I" will display as "我" in this message box, but it won't in Display Name field.

UK

JonB wrote on Sep 23rd, 2009 at 6:59pm:
A. - Do you mean NO-ONE can change their Display Names?

please just for grins, check this setting in Admin Center > Forum Setting > Members
Quote:
Require Members to use a different Displayed Name than their User (login) Name?


or B.  Some persons who could before do so, can no longer change their Display Names?

I suspect the problem lies in the mixed Character sets.  See if the affected user's language preference is set right in their User Control Panel.  It may have defaulted to English during the 'hidden upgrade' that occurs when re-introducing data. (I am not one of the devlopers, this is only a guess).

Good Luck
Smiley

« Last Edit: Oct 15th, 2009 at 11:01pm by UK »  
Back to top
WWW  
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 3,811
Location: Land of the Blazing Sun!

YaBB 2.6.0
Re: Display Name in UTF-8 characters
Reply #4 - Sep 23rd, 2009 at 6:59pm
Post Tools
A. - Do you mean NO-ONE can change their Display Names?

please just for grins, check this setting in Admin Center > Forum Setting > Members
Quote:
Require Members to use a different Displayed Name than their User (login) Name?


or B.  Some persons who could before do so, can no longer change their Display Names?

I suspect the problem lies in the mixed Character sets.  See if the affected user's language preference is set right in their User Control Panel.  It may have defaulted to English during the 'hidden upgrade' that occurs when re-introducing data. (I am not one of the devlopers, this is only a guess).

Good Luck
Smiley
  

I find your lack of faith disturbing.
Back to top
IP Logged
 
UK
YaBB Newcomer
*
Offline



Posts: 11
Re: Display Name in UTF-8 characters
Reply #3 - Sep 23rd, 2009 at 5:49pm
Post Tools
It was no upgrade. We have done a clean-install to v2.4.

The database was residing in v2.3.1 before.

Our forum is in a combination of English & BIG-5.



JonB wrote on Jul 30th, 2009 at 3:36pm:
What did you upgrade from?

And what character set are you using?

Cool

  
Back to top
WWW  
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 3,811
Location: Land of the Blazing Sun!

YaBB 2.6.0
Re: Display Name in UTF-8 characters
Reply #2 - Jul 30th, 2009 at 3:36pm
Post Tools
What did you upgrade from?

And what character set are you using?

Cool
  

I find your lack of faith disturbing.
Back to top
IP Logged
 
OH Eng
Past Team Members
Documentation Team
Offline



Posts: 4,026
Location: Pensacola, Florida USA
Re: Display Name in UTF-8 characters
Reply #1 - Jul 30th, 2009 at 5:39am
Post Tools
Well UTF-8 has a lot of characters... which characters are they trying to use?  Are they trying to use one that isn't allowed, or something different?
  

 
Back to top
 
IP Logged
 
UK
YaBB Newcomer
*
Offline



Posts: 11
[Serious] Display Name in UTF-8 characters
Jul 28th, 2009 at 7:32am
Post Tools
Registered members can no longer change their Display Name in UTF-8 characters.

Is this just my forum or everybody else?


I have recent upgraded to 2.4 from full installation

Edited:
Error message shown:

There is an invalid character detected in the Displayed Name field. Valid Characters are Letters, Numbers, Spaces and ( [ ] # % + , - | . : = ? @ ^ _ )
« Last Edit: Mar 25th, 2010 at 2:55am by »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top