Problem with special characters iso-8859-1/utf-8 (with solution)
Page: 1, 2
Q: Why are strings that use special characters (like äöüß) broken (everything after the special character is trimmed)?
A: If you're using special characters like the german umlauts (äöüß) or other non standard characters inside form fields (for instance in the street field under company details), you could run into problems like the following:
You enter your street adress, lets say it's "Ernst-Thälmann-Straße" (notice the a-Umlaut) and after submitting the page to save the data only "Ernst-Th" appears in the address overview.
Chances are, that your browser uses the wrong character encoding while viewing the page (activeCollab uses "utf-8" so you want to go for that one). While checking the meta-tags activeCollab submits to the user, you see the following:
You try to choose "utf-8" under "View->Character Encoding" in your browser, and after resubmitting the form with utf-8 charset encoding selected, the street field is not cut off anymore, but on the next page, the special characters get displayed distorted (because the browser switched back to another charset encoding i.e. iso-8859-1 etc.).
If that is the case, your webserver probably submits the wrong charset in the http-headers. You can try and find out through watching the output of wget with showing headers activated:
If there's a line saying the following:
you've found the reason why your browser is choosing the "wrong" charset encoding.
Solution:
If you are able the change the virtualhost options of the specific subdomain you're using for activeCollab, you can add another line:
That should solve the problem, at least it worked for me...
hope this helps,
Gabriel
ps: not to mention that this is of course NOT a bug of activeCollab...
A: If you're using special characters like the german umlauts (äöüß) or other non standard characters inside form fields (for instance in the street field under company details), you could run into problems like the following:
You enter your street adress, lets say it's "Ernst-Thälmann-Straße" (notice the a-Umlaut) and after submitting the page to save the data only "Ernst-Th" appears in the address overview.
Chances are, that your browser uses the wrong character encoding while viewing the page (activeCollab uses "utf-8" so you want to go for that one). While checking the meta-tags activeCollab submits to the user, you see the following:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
You try to choose "utf-8" under "View->Character Encoding" in your browser, and after resubmitting the form with utf-8 charset encoding selected, the street field is not cut off anymore, but on the next page, the special characters get displayed distorted (because the browser switched back to another charset encoding i.e. iso-8859-1 etc.).
If that is the case, your webserver probably submits the wrong charset in the http-headers. You can try and find out through watching the output of wget with showing headers activated:
wget -S http://activecollab.example.com
If there's a line saying the following:
Content-Type: text/html; charset=ISO-8859-1
you've found the reason why your browser is choosing the "wrong" charset encoding.
Solution:
If you are able the change the virtualhost options of the specific subdomain you're using for activeCollab, you can add another line:
AddDefaultCharset utf-8
That should solve the problem, at least it worked for me...
hope this helps,
Gabriel
ps: not to mention that this is of course NOT a bug of activeCollab...
Ilija Studen
on Sep 28. 2006. 10:36 am
Thanks for the details explanation. I forgot about that. Apache actually comes with default charset configured to ISO-8859-1. Interesting part is that browser will listen to web server, not to the page so there is no way that script can actually say to browser to use UTF-8 if web server sends ISO-8859-1 header.
Only way to fix this that I know of is described above (by adding AddDefaultCharset utf-8 to the httpd.conf file).
Thanks Gabriel
Btw, I updated the first message to fit the format of all messages in FAQ forum. Hope you don't mind...
Only way to fix this that I know of is described above (by adding AddDefaultCharset utf-8 to the httpd.conf file).
Thanks Gabriel
Btw, I updated the first message to fit the format of all messages in FAQ forum. Hope you don't mind...
activeCollab team member
Maybe another solution would be to resubmit the right content-header every time with the php-header function ( header('Content-type: text/plain; charset=utf-8'); ), but I heaven't tried that one, because I think it wouldn't be a "clean" solution to submit the same header twice (first by apache and afterwards by php).
But if it works, this could be an option for someone sitting on a shared host not beeing able to change the virtual host settings.
But if it works, this could be an option for someone sitting on a shared host not beeing able to change the virtual host settings.
I do have the same problems under Ubuntu. Unfortunately I am not so experienced with apache configuration and I could not solve the problem.
Can you please provide a more detailed step-by-step instruction for solving this problem?
Thanks in advance
Roland
Can you please provide a more detailed step-by-step instruction for solving this problem?
Thanks in advance
Roland
"Rolando":Can you please provide a more detailed step-by-step instruction for solving this problem?
Hi Rolando,
you have to edit your virtual host configuration file (in most cases you'll find it under /etc/httpd/vhost.conf or httpd.conf). There should be some entries defining the virtual hosts. Locate the one that is responsible for your activeCollab host (i.e. ac.private.net)
Add another entry (AddDefaultCharset utf-8) between the virtual-host tags like so:
<VirtualHost *:80> ServerAdmin name@example.com DocumentRoot /srv/www/activeCollab/public/ ServerAlias ac ServerName ac.private.net:80 ErrorLog logs/ac-error.log CustomLog logs/ac-access.log common AddDefaultCharset utf-8 <directory /srv/www/activeCollab/public/> AllowOverride all </directory> </VirtualHost>
If you need a more detailed instruction, maybe here in the forum there's another ubuntu user who can give a more ubuntu focused explanation.
hope that helps,
Gabriel
Can't you just add the line "AddDefaultCharset utf-8" to .htaccess in the home-directory of ActiveCollab?
Ilija Studen
on Oct 31. 2006. 11:03 am
Good one. Simple solution to the rescue! :)
activeCollab team member
@hgpuke:
hehe, of course you are right, as AddDefaultCharset may also appear in .htaccess context
http://httpd.apache.org/docs/2.0/mod/core.html#adddefaultcharset
(as long as the virtualhost is defined to allow .htaccess for the directory through AllowOverride command)
hehe, of course you are right, as AddDefaultCharset may also appear in .htaccess context
http://httpd.apache.org/docs/2.0/mod/core.html#adddefaultcharset
(as long as the virtualhost is defined to allow .htaccess for the directory through AllowOverride command)
This may be an easy solution as well.
Just change the place of <title> tag after <meta> tags on these files below, which output html.
-------------
/activecollab/application/layouts/account.php
/activecollab/application/layouts/administration.php
/activecollab/application/layouts/dashboard.php
/activecollab/application/layouts/dialog.php
/activecollab/application/layouts/error.php
/activecollab/application/layouts/project_website.php
Some browsers, especially Internet Explorer, cannot render character set correctly until they read "charset" in meta tag. When special characters or multibyte characters are in <title> tag before "charset" in <meta> tag, this causes problems sometimes like showing blank page and etc. So just change the place of <title> tag after <meta> tags.
This solution may sound ridiculous but works.
Just change the place of <title> tag after <meta> tags on these files below, which output html.
-------------
/activecollab/application/layouts/account.php
/activecollab/application/layouts/administration.php
/activecollab/application/layouts/dashboard.php
/activecollab/application/layouts/dialog.php
/activecollab/application/layouts/error.php
/activecollab/application/layouts/project_website.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<?php echo stylesheet_tag('project_website.css') ?>
<?php echo meta_tag('content-type', 'text/html; charset=utf-8', true) ?>
<?php echo add_javascript_to_page('yui/yahoo/yahoo-min.js') ?>
<?php echo add_javascript_to_page('yui/dom/dom-min.js') ?>
<?php echo add_javascript_to_page('yui/event/event-min.js') ?>
<?php echo add_javascript_to_page('yui/animation/animation-min.js') ?>
<?php echo add_javascript_to_page('app.js') ?>
<?php echo use_widget('UserBoxMenu') ?>
<?php echo render_page_head() ?>
<title><?php echo get_page_title() ?> @ <?php echo clean(owner_company()->getName()) ?></title>
</head>
Some browsers, especially Internet Explorer, cannot render character set correctly until they read "charset" in meta tag. When special characters or multibyte characters are in <title> tag before "charset" in <meta> tag, this causes problems sometimes like showing blank page and etc. So just change the place of <title> tag after <meta> tags.
This solution may sound ridiculous but works.



