Skip to content

Problems with multibyte unicode characters in filenames #4513

Closed

Description

@georgehrke

Expected behaviour

ownCloud should handle multibyte unicode characters in filenames correctly.

Actual behaviour

ownCloud drops every character after (multibyte) unicode character in a filename

Steps to reproduce

  1. Create a file like "%&:hankey:.pdf" on your computer
  2. Upload it to ownCloud
  3. After the upload, ownCloud displays the name correctly
  4. reload the page
  5. After reloading the page ownCloud shows only "%&"

Server configuration

Operating system:
Debian 7

Web server:
Apache

Database:
MySQL

PHP version:
PHP 5.4.x
The mbstring extension is enabled

ownCloud version:
latest master

Client configuration

Browser:
Chromium 30.0.1592.0

Operating system:
OS X

Activity

  1. georgehrke commented on Aug 19, 2013

    @georgehrke
    ContributorAuthor
  2. DeepDiver1975 commented on Aug 21, 2013

    @DeepDiver1975
    Contributor

    @georgehrke Is the locale en_US.UTF-8 installed? THX

  3. georgehrke commented on Aug 22, 2013

    @georgehrke
    ContributorAuthor

    Yes and it's the only enabled in /etc/locale.gen

  4. DeepDiver1975 commented on Aug 22, 2013

    @DeepDiver1975
    Contributor
  5. DeepDiver1975 commented on Aug 22, 2013

    @DeepDiver1975
    Contributor

    hmm - browsers on my debian are not capable of displaying the character properly:
    http://en.wikipedia.org/wiki/%F0%9F%92%A9

    Nautilus can't either.

    I really wonder if we shall support all kinds of crazy characters out there.
    No clue what will happen once we sync a file name with such a character to Windows

  6. natschil commented on Aug 22, 2013

    @natschil

    "I really wonder if we shall support all kinds of crazy characters out there."

    Owncloud should definetly support UTF-8 in its entirety. It isn't up to owncloud to display the characters correctly though, that is the browser's responsibility.

  7. karlitschek commented on Aug 26, 2013

    @karlitschek
    Contributor

    That's indeed strange. ownCloud should fully support UTF-8. The fact that is shows up correctly after upload and is broken after reload indicates that the bug might be somewhere in the frontend/js code. Maybe a wrong encoding somewhere in an ajax call?

  8. whitehairtong commented on Mar 25, 2014

    @whitehairtong

    I checked on the coding, and as far as I can see that in OC\LIB\PRIVATE\FILES\Mapper.php

    the private function slugify($text) is seems doing a job to remove any unicode part of the file name and store only the ASCI part of the file name into physical_path.
    private function slugify($text)
    {
    // replace non letter or digits or dots by -
    $text = preg_replace('~[^\pL\d.]+~u', '-', $text);

    // trim
    $text = trim($text, '-');
    
    // transliterate
    if (function_exists('iconv')) {
        $text = iconv('utf-8', 'us-ascii//TRANSLIT//IGNORE', $text);
    }
    
    // lowercase
    $text = strtolower($text);
    
    // remove unwanted characters
    $text = preg_replace('~[^-\w\.]+~', '', $text);
    
    // trim ending dots (for security reasons and win compatibility)
    $text = preg_replace('~\.+$~', '', $text);
    
    if (empty($text)) {
        return uniqid();
    }
    

    When I do a test to change this function so that only $text is returned without any modification, the correct unicode part of the file path can be stored into mysql database for both logic_path and also physic_path in oc_file_map mysql databse 5.6.14 in windows environment.

    without the modification, OC 6.0.2 will actually store files without the unicode part of the name into both the physic_path in mysql database and also the actual file name on the data folder

    (unicode).pdf becomes -.pdf

    Andrew

  9. modified the milestone: backlog on Mar 21, 2015
  10. 9 remaining items

  11. PVince81 commented on Dec 12, 2016

    @PVince81
    Contributor

    @DeepDiver1975 doctrine migrations merged. Can you move forward with the 4 byte unicode PR ?

  12. michaelstingl commented on Dec 20, 2016

    @michaelstingl

    for reference: 00006329

  13. self-assigned this
    on Mar 7, 2017
  14. cdamken commented on Mar 7, 2017

    @cdamken
    Contributor

    Hi Guys, could you please tell me some feedback from this issue?

  15. DeepDiver1975 commented on Mar 8, 2017

    @DeepDiver1975
    Contributor

    Fixed with oc10

  16. PVince81 commented on Mar 8, 2017

    @PVince81
    Contributor
  17. lock commented on Aug 2, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions