![]() |
Converting Special Chars from HTML to UTF-8 ascii standard?
Hey there,
I'm using the AddonChat Integration Script and have been working with Chris Duerr, the author, to try and solve this problem: users that have special characters (such as accents, as in ? ? ? ? ?) are getting an invalid username/password notice. This is because vBulletin stores these special characters as HTML escape equivalents. How can we convert the HTML escape characters to UTF-8 standard ascii characters? Here is the code cited from the integration script: Code:
<?php Code:
$username = html_entity_decode($username); |
There is a function in vb called unhtmlspecialchars()
From the documentation ; Code:
Returns a string where HTML entities have been converted back to their original characters |
Thanks, Paul! However, that didn't seem to work. I added:
Code:
$username = unhtmlspecialchars($username); |
Latest information from Chris Duerr, the original hack author:
Quote:
|
I didn't really read your code, you asked about decoding, which was what I answered.
Looking at your code then yes, you need to do the opposite, you want to code your username to match vb. The vb function is htmlspecialchars_uni(), but I believe vb does more than just that. |
Thanks, Paul. I gave that a shot, but strangely, still no luck. Specifically, I used:
$username = htmlspecialchars_uni($username); $password = htmlspecialchars_uni($password); ... and I still got invalid returns from the system. Then looking further, I also saw that the chat_auth.php code provided by Chris Duerr had already apparently done this analysis: Code:
# Fetch User Info from Database.. |
You need to look in the user datamanager to see what other conversions vb does.
|
Quote:
|
class_dm_user.php in the includes folder.
|
Kaelon -- Just curious if we ever found a solution to this? I'm working on the 3.7 mod now, and would like to find a solution that doesn't require a non-standard php library.
|
Quote:
Unfortunately, no. Any of my users that have special characters in their usernames (such as accents, which are very common in Romance languages such as Spanish and French) have never been able to log in to our chat room properly. My recommendation would be to definitely allow special characters in the future. Let me know how your progress goes with regards to this. Thanks, Juan |
Ok, Jaun -- We're working on the next update for v3.7 now. I'll look into this and see what we can do. :)
|
Quote:
|
The release candidate is now online for v3.7 integration. You can get it from http://forums.addoninteractive.com/s...ead.php?t=3915
If you prefer to stick with 3.5/3.6, this is the code I've found to work but admittedly only tested on v3.7, though I don't think the way usernames are stored in the database has changed. mb_convert_encoding almost does the trick, but not quite. I found the following code posted at php.net, and modified it so that HTML character codes aren't used for anything other than UTF-8 characters in the > 8 bit range, and it also allows for special characters (like '<') -- though some usernames with these special characters aren't permitted by the AddonChat chat software. I've tested it using various English, Spanish and Arabic characters, and it seems to be working. Again though, if you're running v3.7 -- just download the release candidate and let me know if you run into any problems :) PHP Code:
PHP Code:
PHP Code:
|
All times are GMT. The time now is 09:20 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|