Hi all, I'm fairly new to the inner workings of vBulletin and I found myself tackling a bug when users would post directly from MS Word or Appleworks. Now these programs have the SmartQuotes and AutoCorrect options and those seemed to be Windows 1252 encodings so when the user would enter their text with copy and paste, what was happening was the moment the post hit a non UTF-8 character, the rest of the post would get cut off. I didn't have much luck finding any help with some vBulletin googling. After a lot of searching around though I found a helpful post on the php forums. All it required I do was add the following bolded code in includes/class_core.php:
Code:
function htmlspecialchars_uni($text, $entities = true)
{
$text = mb_convert_encoding($text,"HTML-ENTITIES","auto");
return str_replace(
// replace special html characters
array('<', '>', '"'),
array('<', '>', '"'),
preg_replace(
// translates all non-unicode entities
'/&(?!' . ($entities ? '#[0-9]+' : '(#[0-9]+|[a-z]+)') . ';)/si',
'&',
$text
)
);
}
As I said before I'm not too familiar with the vBulletin innerworkings nor PHP and I just want to make sure I'm not invalidating any security measures with HTML using this? If I'm not then maybe someone else who is having the same problems might find this useful.
Thanks for any insight,
orth