i'm trying to create nodes and taxonomy terms through a custom php script by using the node_save() function.
I'm working on drupal 6.
It's working well (thanks to previous questions on stackoverflow) except for accented letters.
Indeed, when a title or a taxonomy term contain "é", "è" or "à", the sentence is cut before those special characters.
For example, a title like that: "Bonjour les éléphants" will create a node with "Bonjour les " as title.
I don't know if it's linked to my database or if i have to use a special encoding in php (iconv() blabla)
The fact is, for drupal titles, i can not use html encoding (for example: é is é in html) because drupal will render é and not é...
When i create a taxonomy or a title manually, i have no problems and the accented letter is saved in the database as "é".
Soo if you can help me to create terms and title with accented letters, that will be great : )
Thank you !
This kind of looks like some sort of encoding/charset problem...
With Drupal, everything is encoded (and expected) in the UTF-8 charset .
Not sure it'll solve/fix your problem, but you should make sure that everything in your application is working with/in UTF-8 :
node_save
on it, you must make sure it's in UTF-8
utf8_encode
function might help mb_convert_encoding
, depending on the charset used by your input data.
I've run into exactly that problem of strings cut before accented characters a couple of times, and, each time, making sure the strings were passed as UTF-8 solved it -- so maybe it'll work for you too ^^
In Eclipse you can change this as following:
Preferences > General > Workspaces, set "Text file encoding" to "Other : UTF-8".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.