Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"AddDefaultCharset utf-8" should be added to main .htaccess file #1012

Closed
j-ed opened this issue Dec 22, 2012 · 8 comments
Closed

"AddDefaultCharset utf-8" should be added to main .htaccess file #1012

j-ed opened this issue Dec 22, 2012 · 8 comments

Comments

@j-ed
Copy link
Contributor

j-ed commented Dec 22, 2012

If you install OwnCloud on a server where the default charset is e.g. iso-8859-1 a lot of special characters are not properly displayed because OwnCloud uses utf-8 by default. Adding the option "AddDefaultCharset utf-8" to the main .htaccess file fixes the problem.

@DeepDiver1975
Copy link
Member

THX for the hint! Any idea how to define this in other web servers?

@j-ed
Copy link
Contributor Author

j-ed commented Dec 22, 2012

I'm using an Apache web server and there you can set this parameter in the web server configuration itself (http://httpd.apache.org/docs/2.2/de/mod/core.html) or by setting it via a .htaccess file.

@tanghus
Copy link
Contributor

tanghus commented Dec 22, 2012

The default charset for OC is UTF-8 as is should be, and all headers contains <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />.
We had some errors in early releases where the database wasn't set up to use it, but they should be resolved by now.
If the data served, and the charset in the header is set explicitly, isn't it a browser error if it doesn't interpret it correctly?
If not we could probably set it in the headers without having to touch the webserver config, which would only work for a (large) subset of servers.

@j-ed
Copy link
Contributor Author

j-ed commented Dec 23, 2012

I've just tested it on a server where the default charset has been set to ISO-8859-1. All headers which were delivered contained Content-Type: text/html; charset=iso-8859-1.
After I'd added "AddDefaultCharset utf-8" to the main .htaccess file of OwnCloud the delivered headers instantly changed to Content-Type: text/html; charset=utf-8 and all special characters were displayed properly.
I think the best and easiest way to force utf-8 usage would be to add it to the main .htaccess file.

@Merowinger
Copy link

Hello. I had the same problem using OC in German environment. File scanning produced cutted files / directories in PREFIX_fscache. I eddited three files forcing utf8 encode / decode of files / directories. Is working fine now:

  1. To insert files / directories with special chars: lib/filecache.php function put
    change line: $result=$query->execute(array($parent,basename($fullpath),$fullpath, ...
    to: $result=$query->execute(array($parent,basename(utf8_encode($fullpath)),utf8_encode($fullpath), ...

  2. To open files with special chars: lib/files.php function get
    add as first line in function: $files = utf8_decode($files);

  3. To open directories with special chars: apps/files/index.php
    change line: $dir = isset( $_GET['dir'] ) ? urldecode(stripslashes($_GET['dir'])) : '';
    to: $dir = isset( $_GET['dir'] ) ? utf8_decode(urldecode(stripslashes($_GET['dir']))) : '';

@BernhardPosselt
Copy link
Contributor

#1929

@BernhardPosselt
Copy link
Contributor

Please reopen if this issue has not been fixed in owncloud 5.0 master with the above pullrequest

@BernhardPosselt
Copy link
Contributor

@Merowinger please create a pull request to merge this if you want to

@lock lock bot locked as resolved and limited conversation to collaborators Aug 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants