View previous topic :: View next topic |
Author |
Message |
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Mon May 03, 2010 3:15 pm Post subject: Encodingsettings for html_select_date |
|
|
Hey guys,
my site is running in UTF8. The Problem now is that your html_select_date plugin is working with ISO-8859-1 so i got this "M�rz" instead of "März" which is March in english.
How cand i fix it?
I am using version 1.3.4 of the plugin by the way.
Gr33tZ
Rn
Edit:
Okay, some things i should also mention:
Windows-Apache-Server,
setlocale(LC_ALL, 'de_DE@euro.UTF8', 'de_DE.UTF8', 'deu_deu.UTF8', 'de.UTF8', 'ge.UTF8', 'de_DE@euro', 'de_DE', 'deu_deu', 'de', 'ge');
Basically it is right, but because windows does not support UTF8 it just can work.
Doesn't matter. That need to be fixed |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue May 04, 2010 2:00 am Post subject: |
|
|
How is the html_select_date plugin tied to ISO-8859-1? It should work with utf8 no problem. Just be sure things are setup in PHP correctly (locale) and your html charset matches. |
|
Back to top |
|
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Wed May 05, 2010 9:10 am Post subject: |
|
|
i am sure. Everthing else is working.
But i think, like i already mentionend, that it is a problem with windows because there is no locale value with '.UTF8'. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed May 05, 2010 1:47 pm Post subject: |
|
|
html_select_date uses strftime() and htmlspecialchars() internally to format a date. Once you have that working, then html_select_date should too. |
|
Back to top |
|
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Thu May 06, 2010 10:53 am Post subject: |
|
|
Ehm..i cant find "htmlspecialchars()" in function.html_select_date.php and the only html escape function with charset-support i can find is in modifier.escape.php. But i dont know that can help me. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu May 06, 2010 1:14 pm Post subject: |
|
|
see the shared file that html_select_date function uses for escapement. |
|
Back to top |
|
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Thu May 06, 2010 1:53 pm Post subject: |
|
|
yeah,
it's shared.escape_special_chars.php but there is nothing with encoding settings.
Why there is not property of smarty which is defining the global to use charset?
$smarty->charset = 'UTF8' or something. Would be much easier than this.
What should i do in this shared file to keep it dynamic and make it work for my needs? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu May 06, 2010 3:12 pm Post subject: |
|
|
That is what I'm saying, there isn't anything in Smarty that is character set specific. So long as you have PHP setup correctly, and your HTML page character set is correct in the browser, your characters should show correctly assuming they match your setup.
so:
* set PHP locale to UTF8
* set HTML PAGE (meta tag, header, etc) to UTF8
* be certain the text your are displaying is UTF8 compliant
* be sure database connection and tables are UTF8 compliant (if coming from there)
* be sure all PHP functions that your text pass thru are UTF8 compliant
Smarty makes use of PHP functions under the hood to do its job, so if it works in PHP, is should work here too. Where there are PHP functions that take a character set, UTF8 is the default. Smarty 3 does have a constant defined for default character set, but that is UTF8 by default as well. |
|
Back to top |
|
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Fri May 07, 2010 11:42 am Post subject: |
|
|
I have all this things set up correctly but i can set the local to utf8 in windows because it is not supported in setlocale.
Also i am using the "latest stable version" so i am using 2.6.26 not 3.0. Is that a problem ? Because i think "stable version" means to the user: use this if you totally want to run smarty 100 percent correctly, doesn't it?
Edit:-->
Okay. Just tried it on linux server and it still does not work also with locale set to 'de_DE@euro.UTF8'.
My html code metatag is set to utf8 also.
What do you exactly mean by "utf8 complain" and what do you mean with "your text"? The text which i am complaining about is from your function.
My data is not comming from the db its comming from your html_select_date function.
I am not parsing the text through anything.
I just assign a few vars to it (none that would influence the html_select_date) and then i include the sub template via inlcude in the main template of the section. |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
|
Back to top |
|
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Fri May 07, 2010 1:36 pm Post subject: |
|
|
How should i use the escape modifier with this function:
Code: |
{html_select_date prefix='end_' field_order='DMY' month_empty='Monat' month_extra='disabled=disabled' day_empty='Tag' day_extra='disabled=disabled' start_year='-5' end_year='+5' year_extra='disabled=disabled' time=$date}
|
I dont have any problems with my var given to the html_select_date function. I have problem with output itself. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri May 07, 2010 2:14 pm Post subject: |
|
|
So just to get this straight, a template as simple as:
Code: | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>foobar</title>
</head>
<body>
{html_select_date}
</body>
</html> |
Will output messed up utf8 characters? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
Back to top |
|
regsnerven Smarty Rookie
Joined: 26 Mar 2010 Posts: 20
|
Posted: Mon May 10, 2010 5:30 pm Post subject: |
|
|
Yep it does on windows.
And that topic is not related to this one because the question in that topic is how to do get german output not how to get proper decoded output. ^^ |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon May 10, 2010 7:08 pm Post subject: |
|
|
I setup my server with:
Code: | setlocale(LC_ALL, 'de_DE@euro.UTF8', 'de_DE.UTF8', 'deu_deu.UTF8', 'de.UTF8', 'ge.UTF8', 'de_DE@euro', 'de_DE', 'deu_deu', 'de', 'ge'); |
Then have a template:
Code: | START
{html_select_date}
END |
Here is the output:
(see next post)
So how do I replicate your problem?
Last edited by mohrt on Mon May 10, 2010 7:36 pm; edited 1 time in total |
|
Back to top |
|
|