Problem with special characters in calendar (Bulletproof)
-
alemartini
- Regular
- Posts: 16
- Joined: Sat Oct 11, 2008 10:43 pm
Problem with special characters in calendar (Bulletproof)
I'm setting up a new blog using s9y 1.3.1 with the Bulletproof style. The site is in spanish, and every special character is being displayed as it should, with just one small but annoying exception: the calendar plugin.
At the top of the calendar, you can see the names of the days shortened to two characters. Each of the days is OK, except for "Sábado" (Saturday), which should be displayed as "Sá", but it's actually shown as "S?" (a capital S followed by a question mark enclosed in a diamond shape).
I guess that there must be some problem with the calendar plugin when the blog has been set up for a foreign language. However, I still can't find what is causing the problem or how to fix it.
Any ideas on how to solve this?
Thanks in advance!,
Alex
At the top of the calendar, you can see the names of the days shortened to two characters. Each of the days is OK, except for "Sábado" (Saturday), which should be displayed as "Sá", but it's actually shown as "S?" (a capital S followed by a question mark enclosed in a diamond shape).
I guess that there must be some problem with the calendar plugin when the blog has been set up for a foreign language. However, I still can't find what is causing the problem or how to fix it.
Any ideas on how to solve this?
Thanks in advance!,
Alex
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Problem with special characters in calendar (Bulletproof)
Hi!
Yes, this is because your server does not seem to have the spanish UTF-8 locale installed (usually es_ES.UTF-8). You could ask your provider if he can install all spanish UTF-8 locales.
Regards,
Garvin
Yes, this is because your server does not seem to have the spanish UTF-8 locale installed (usually es_ES.UTF-8). You could ask your provider if he can install all spanish UTF-8 locales.
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/
# 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/
-
alemartini
- Regular
- Posts: 16
- Joined: Sat Oct 11, 2008 10:43 pm
Re: Problem with special characters in calendar (Bulletproof)
Hi Garvin,
I've checked the hosting account and it does provide the UTF-8 spanish locale.
If I publish a post on a Saturday, the date on the post shows OK as "Sábado". Even on the calendar, the tooltip for "S?" displays "Sábado".
I made a very simple php file in order to test this:
The code above displays the following:
So I guess there must be something wrong with the calendar plugin, since everything else is working as expected.
BTW, the HTML source code for the calendar looks like this:
Is there anything else I should check?
Thanks again,
Alex
I've checked the hosting account and it does provide the UTF-8 spanish locale.
If I publish a post on a Saturday, the date on the post shows OK as "Sábado". Even on the calendar, the tooltip for "S?" displays "Sábado".
I made a very simple php file in order to test this:
Code: Select all
setlocale (LC_TIME, 'es_ES.utf8');
echo "Saturday: ".strftime ("%A", mktime(0,0,0,02,14,2009));
echo "<br>Sat: ".strftime ("%a", mktime(0,0,0,02,14,2009));
Code: Select all
Saturday: sábado
Sat: sáb
BTW, the HTML source code for the calendar looks like this:
Code: Select all
<th id="Sá" scope="col" abbr="Sábado" title="Sábado" class="serendipity_weekDayName" align="center">S�</th>Thanks again,
Alex
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Problem with special characters in calendar (Bulletproof)
Hi!
Ah, I think I know what's happening. Some plugin_Calendar.tpl files uses "truncate" to only get the first X characters. However in UTF-8 this will split one special char in half, so you would need to truncate by 3 characters instead of 2...
HTH,
Garvin
Ah, I think I know what's happening. Some plugin_Calendar.tpl files uses "truncate" to only get the first X characters. However in UTF-8 this will split one special char in half, so you would need to truncate by 3 characters instead of 2...
HTH,
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/
# 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/
-
alemartini
- Regular
- Posts: 16
- Joined: Sat Oct 11, 2008 10:43 pm
Re: Problem with special characters in calendar (Bulletproof)
If I change the truncate call in plugin_calendar.tpl so that it keeps 3 characters instead of 2, then Wednesday is shown as "Mi?" (it's spelled "Miércoles" in spanish).
But knowing where the problem is, I looked for issues related to Smarty, truncate and UTF-8 strings, and found a workaround here:
Multibyte String Truncate Modifier for Smarty - mb_truncate
I don't know if there's a better way to solve this, but I've followed the steps in that post, and it worked like a charm.
Thank you for pointing me in the right direction!
Best regards,
Alex
But knowing where the problem is, I looked for issues related to Smarty, truncate and UTF-8 strings, and found a workaround here:
Multibyte String Truncate Modifier for Smarty - mb_truncate
I don't know if there's a better way to solve this, but I've followed the steps in that post, and it worked like a charm.
Thank you for pointing me in the right direction!
Best regards,
Alex
Re: Problem with special characters in calendar (Bulletproof)
Perhaps we should add a mb_truncate modifier to the ones s9y supplies.
-
Don Chambers
- Regular
- Posts: 3657
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Problem with special characters in calendar (Bulletproof)
I second the motion....judebert wrote:Perhaps we should add a mb_truncate modifier to the ones s9y supplies.
=Don=
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Problem with special characters in calendar (Bulletproof)
Hi!
Sadly mbstring is not always existing, so a fallback method needs to be employed.
Regards,
Garvin
Sadly mbstring is not always existing, so a fallback method needs to be employed.
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/
# 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/
Re: Problem with special characters in calendar (Bulletproof)
I have got the same problem with Norwegian characters in the calendar. Saturday = Lørdag, Sunday = Søndag. The character ø gives the calendar problems.
***
Bjørn Roger Rasmussen, Norway - http://www.brr.no/
Bjørn Roger Rasmussen, Norway - http://www.brr.no/
-
alemartini
- Regular
- Posts: 16
- Joined: Sat Oct 11, 2008 10:43 pm
Re: Problem with special characters in calendar (Bulletproof)
After performing an upgrade to s9y 1.4.1, the calendar in Bulletproof broke again
After the upgrade I applied the workaround that I mentioned before, but this time it isn't working (the calendar is showing "S?" where it should display "Sá").
I can tell for sure that this isn't a problem with PHP or my hosting environment, since if I run the code shown below, it shows all the strings perfectly.
So, is there any way to solve this problem in s9y?
Edit : on IE the calendar output looks even worse. The first line displays "Do Lu Ma Mi Ju Vi Sü/th>" . And here's the source that IE shows:
After the upgrade I applied the workaround that I mentioned before, but this time it isn't working (the calendar is showing "S?" where it should display "Sá").
I can tell for sure that this isn't a problem with PHP or my hosting environment, since if I run the code shown below, it shows all the strings perfectly.
Code: Select all
setlocale (LC_TIME, 'es_ES.utf8');
echo "Saturday: ".strftime ("%A", mktime(0,0,0,02,14,2009));
echo "<br>Sat: ".strftime ("%a", mktime(0,0,0,02,14,2009));
echo "<br>Sa: ".mb_substr(strftime ("%a", mktime(0,0,0,02,14,2009)), 0, 2, 'UTF-8');Edit : on IE the calendar output looks even worse. The first line displays "Do Lu Ma Mi Ju Vi Sü/th>" . And here's the source that IE shows:
Code: Select all
<th id="Dom" scope="col" abbr="Domingo" title="Domingo" class="serendipity_weekDayName" align="center">Do</th>
<th id="Lun" scope="col" abbr="Lunes" title="Lunes" class="serendipity_weekDayName" align="center">Lu</th>
<th id="Mar" scope="col" abbr="Martes" title="Martes" class="serendipity_weekDayName" align="center">Ma</th>
<th id="MiÃ" scope="col" abbr="Miércoles" title="Miércoles" class="serendipity_weekDayName" align="center">Mi</th>
<th id="Jue" scope="col" abbr="Jueves" title="Jueves" class="serendipity_weekDayName" align="center">Ju</th>
<th id="Vie" scope="col" abbr="Viernes" title="Viernes" class="serendipity_weekDayName" align="center">Vi</th>
<th id="Sá" scope="col" abbr="Sábado" title="Sábado" class="serendipity_weekDayName" align="center">SÃ</th>-
alemartini
- Regular
- Posts: 16
- Joined: Sat Oct 11, 2008 10:43 pm
Re: Problem with special characters in calendar (Bulletproof)
Well, after opening plugin_calendar.tpl and saving it (without changing a single byte), everything went back to normal.
A server-side caching problem maybe? I'm not sure. I don't even know why it stopped working in the first place. But fortunately, the calendar is now working as expected
(tested with Opera, FF and IE).
A server-side caching problem maybe? I'm not sure. I don't even know why it stopped working in the first place. But fortunately, the calendar is now working as expected