Skip to content

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

Closed

Description

@j-ed

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.

Activity

  1. DeepDiver1975 commented on Dec 22, 2012

    @DeepDiver1975
    Contributor

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

  2. j-ed commented on Dec 22, 2012

    @j-ed
    ContributorAuthor

    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.

  3. tanghus commented on Dec 22, 2012

    @tanghus
    Contributor

    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.

  4. j-ed commented on Dec 23, 2012

    @j-ed
    ContributorAuthor

    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.

  5. Merowinger commented on Dec 23, 2012

    @Merowinger

    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']))) : '';

  6. BernhardPosselt commented on Feb 26, 2013

    @BernhardPosselt
    Contributor
  7. BernhardPosselt commented on Feb 26, 2013

    @BernhardPosselt
    Contributor

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

  8. BernhardPosselt commented on Feb 26, 2013

    @BernhardPosselt
    Contributor

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

  9. locked as resolved and limited conversation to collaborators on Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions