to create a breadcrumb navigation in a client's blog. Unfortunately, the breadcrumb nav emits a "?" character for German umlauts in entry titles, i.e. in this entry.
So it's probably about character encoding. How do I solve this?
UTF-8 characters are 2-byte; truncate operates on the "1-byte" basis. Unfortunately in your entry, the "ü" occurs just at 40 bytes, and half of the UTF-8 "ü" is cut, resulting in an illegal char.
Try to add or remove some spacing to make truncate operate better, or maybe don't truncate? Or you might want to check if smarty has a multibyte-string aware truncate, like PHP has substr() and mb_substr()?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking wrote:UTF-8 characters are 2-byte; truncate operates on the "1-byte" basis. Unfortunately in your entry, the "ü" occurs just at 40 bytes, and half of the UTF-8 "ü" is cut, resulting in an illegal char.
Ah, I see.
garvinhicking wrote:Try to add or remove some spacing to make truncate operate better, or maybe don't truncate? Or you might want to check if smarty has a multibyte-string aware truncate, like PHP has substr() and mb_substr()?
I don't think either changing the spacing or not truncating are options here. This particular client uses extremely long entry titles rather frequently, also switches between German and English frequently. There's just no way to predict a good point to truncate, but not truncating at all might result in a cluttered breadcrumb navigation.
I'll see if I can find something helpful in the Smarty docs over the weekend. Thank you so much, Garvin.