form textfield title in Drupal does not accept special caracters
I'm trying to give element of a drupal form using the form_alter hook a title that contains special characters (é,è,à ...)
$form['title'] = array(
'#type' => 'textfield',
'#title' => 'this is my title é à test',
'#required' => TRUE
);
that gives me a blank output on the form page
using the check_plain() function for the title does not affect the output :s ,still blank I though it's an encoding problem but I checked all my enc settings (database,server,theme template) they are all s开发者_高级运维et to utf-8
please note that when entering a value that contain special characters everything goes normal . i think the problem here is about Drupal core doesn't accept special characters in its #title field ?
Well, first, you should use english in code and then translate it.
Check the encoding of that file...
If you try it outside of drupal, just a plain PHP fail that prints these characters, does it work?
I too faced some similar problems with french module. I agree that Berdir's solution is the recommended one but if you really need to put accents in your code you have to encode first your files.
In Notepad++ you can you the Encode menu to achieve this, select "Encode in UTF-8 (without BOM)" and check the bottom right of your file to see its format, it should say "ANSI as UTF-8".
Removing BOM is very important as it can "messed up" Linux servers.
精彩评论