PDA

View Full Version : Problems with title encoding.


Essencee
07-21-2009, 04:48 PM
Hello guys.

I have written a small modification to my vBulletin system, which allows to bold threads titles. In the newthread templete, I added a radio / input type which allows the user to choose if he wants to bold the thread title or not.

The problem is as such: I added this code to the newthread.php file:

...

$newpost['title'] =& $vbulletin->GPC['subject'];
$newpost['iconid'] =& $vbulletin->GPC['iconid'];

if ($_POST["boldtitle"])
{
if ($_POST["boldtitle"] == "yes")
{
$boldtitle = "<b>{$newpost['title']}</b>";
$newpost['title'] = $boldtitle;
}
}

require_once(DIR . '/includes/functions_prefix.php');

...
The problem is that the title is inserting to the database like this: &lt;b&gt;test&lt;/b&gt;Actually, it needs to be like this:

<b>test</b>


The encoding of the title field in the database is latin1_swedish_ci.
The encoding of the database connection is utf8_unicode_ci.

Please, help me.
Thanks :)

Dismounted
07-22-2009, 07:00 AM
The ThreadPost data manager automatically cleans the fields of HTML, so your tags will be converted into HTML entities.

Essencee
07-22-2009, 10:24 AM
So what can I do, please?

Dismounted
07-22-2009, 11:43 AM
What I would do is create a new field where you store if the title is to be "bolded". Then check this field in showthread. This solution means that the original title is not modified, and the modification can be removed easily.