Special Characters and submit_post

Discussion forum for MOD Writers regarding MOD Development.
Locked
sgmartin18
Registered User
Posts: 6
Joined: Thu Dec 18, 2008 6:58 pm

Special Characters and submit_post

Post by sgmartin18 »

I have a custom template that creates a new topic, but if I use special characters in the text, whatever is inside those special characters is lost plus the special characters.

Example:
If a user is describing a process and wants to use the following:
<server name>

everything here is omitted inside the topic after submitted using submit_post. Do I need to prepare the data in some fashion prior to submitting it?
poppertom69
Registered User
Posts: 383
Joined: Wed Jun 06, 2007 7:44 am
Location: Bucks, UK
Name: Tom Martin

Re: Special Characters and submit_post

Post by poppertom69 »

Whats your request_var for the message you are submitting? copy the line here you need to enable multibyte and utf8_normalize it
Do one thing everyday, that scares you!
sgmartin18
Registered User
Posts: 6
Joined: Thu Dec 18, 2008 6:58 pm

Re: Special Characters and submit_post

Post by sgmartin18 »

The data comes across as a POST and then this:

$my_subject = utf8_normalize_nfc($subject);
$my_text = utf8_normalize_nfc($bb_code);

generate_text_for_storage($my_subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($my_text, $uid, $bitfield, $options, true, true, true);


I'm generating BBCode to be inserted into the topic.
poppertom69
Registered User
Posts: 383
Joined: Wed Jun 06, 2007 7:44 am
Location: Bucks, UK
Name: Tom Martin

Re: Special Characters and submit_post

Post by poppertom69 »

You should really use

$subject = utf8_normalize_nfc(request_var('subject', '', true));

if that doesn't help post your script here and i will look though it for you
Do one thing everyday, that scares you!
sgmartin18
Registered User
Posts: 6
Joined: Thu Dec 18, 2008 6:58 pm

Re: Special Characters and submit_post

Post by sgmartin18 »

That fixed it, thanks for your help.
Locked

Return to “[3.0.x] MOD Writers Discussion”