annams
Tue 31st Oct '00, 6:09pm
Hello all,
I am not sure how much of interest is out there for supporting foreign languages in vB. In any case here is what I had to do for adding Hindi support (via Unicode)to vB -
Problem
======
vB is translating Unicode characters (they are represented as &#number; where number is the Unicode value) as seen in the following test message I posted.
http://www.vbulletin.com/forum/showthread.php?postid=34253
Solution
======
After digging into the code I found that vB uses htmlspecialchars() function for displaying titles, member names etc. And this htmlspecialchars() blindly translates every & found to <pre>&</pre> including the ones found within Unicode characters.
So I went ahead and added my own htmlspecialchars_u() and recompiled php. My function looks at the next character to be not '#' before translating any &. Then I replaced all htmlspecialchars() in vB references with htmlspecialchars_u().
Though, it would be easier for me to skip calling htmlspecialchars() all together from the vB code, I thought I would keep the intended functionality.
I appreciate any feedback on whether my approach is correct one or not?
Thanks,
Annam
[Edited by annams on 11-01-2000 at 12:21 PM]
I am not sure how much of interest is out there for supporting foreign languages in vB. In any case here is what I had to do for adding Hindi support (via Unicode)to vB -
Problem
======
vB is translating Unicode characters (they are represented as &#number; where number is the Unicode value) as seen in the following test message I posted.
http://www.vbulletin.com/forum/showthread.php?postid=34253
Solution
======
After digging into the code I found that vB uses htmlspecialchars() function for displaying titles, member names etc. And this htmlspecialchars() blindly translates every & found to <pre>&</pre> including the ones found within Unicode characters.
So I went ahead and added my own htmlspecialchars_u() and recompiled php. My function looks at the next character to be not '#' before translating any &. Then I replaced all htmlspecialchars() in vB references with htmlspecialchars_u().
Though, it would be easier for me to skip calling htmlspecialchars() all together from the vB code, I thought I would keep the intended functionality.
I appreciate any feedback on whether my approach is correct one or not?
Thanks,
Annam
[Edited by annams on 11-01-2000 at 12:21 PM]