Core: Set PHP default-charset in the .htaccess file when it is not set in the php.ini file

Created on 20 Mar 2015  路  8Comments  路  Source: owncloud/core

Description

I separately installed OC 8.0.2 and OC 7.0.2 at a hosting company. An auto-installer "Installatron" did the job for me.
Since OC8 I'm getting the same error message as shown in issue #14216 .
I cannot access and change the php.ini file. And above, I would have to do that at 2 hosting companies.
From running phpinfo.php I can find that the default_charset is set to "no value" at both companies.

To solve the problem I had to put the line php_value default_charset UTF-8 in the .htaccess file just after the line AddDefaultCharset utf-8 (as discussed at: https://forum.owncloud.org/viewtopic.php?f=31&t=26289&sid=05827e7c4d515e32f7b8fe62ec6022c4&start=10 and https://forum.owncloud.org/viewtopic.php?f=31&t=27138 )
I'm not sure about the best position for these UTF-8 setting lines.
Anyhow it solves the problem of the error message.

In issue #14966 the introduction of an additional check on the PHP settings in OC8 has been mentioned. That might be the explanation why I have no problems at OC7.

How to get this solution in the installer packages (.htaccess files in the automatic distributions)?
In which version can it be introduced?

Bug

Most helpful comment

.htaccess
AddDefaultCharset UTF-8
php_value default_charset UTF-8

.user.ini
default_charset="UTF-8"

All 8 comments

@LukasReschke can you please have a look? THX

That's already fixed in master, but we didn't backport this change to stable8 and older versions. Best idea would be to update the whole stable8 block with the one from master in .htaccess and .users.ini.

PR is at https://github.com/owncloud/core/pull/15231 if we want to backport these.

closing as this has been merged

.htaccess
AddDefaultCharset UTF-8
php_value default_charset UTF-8

.user.ini
default_charset="UTF-8"

@juliogilabert what are you trying to tell us with that comment?

Hi @DeepDiver1975
I was just commenting how to fix it so more summarized
By modifying these two files:

.htaccess
AddDefaultCharset UTF-8
php_value default_charset UTF-8

.user.ini
default_charset="UTF-8"

@juliogilabert
The php ones are already in for OC8.0.3: https://github.com/owncloud/core/issues/15231

.user.ini
default_charset="UTF-8"

@juliogilabert this did the trick for me. Thanks for posting.

Was this page helpful?
0 / 5 - 0 ratings