Skip to content

Syncthing should offer fixing UTF-8 encoding issues/conflicts #430

Closed

Description

@endolith

I got the error

File "..." contains non-NFC UTF-8 sequences and cannot be synced. Consider renaming.

many times on many files.

  1. I don't know what non-NFC means. Message should be more clear.
  2. Syncthing should sync all files regardless of their names. These are both Windows 7 machines, so there's no compatibility problem between the OSes. If there is a problem, like Linux using ":" in filenames and syncing with Windows, it should sync the files anyway and sanitize the names for each OS.

Activity

  1. endolith commented on Jul 22, 2014

    @endolith
    Author

    (It seems most of these files contain "Ω" (ohm sign) in the filename, while NFC wants it to be converted to "Ω" (capital Omega) for transmission? I don't see why it can't just use the same "ohm sign" filename on both ends, though. Anyway, the software should handle things like this automatically.)

  2. endolith commented on Jul 22, 2014

    @endolith
    Author

    actually it was only 2 files, but it gave me 2 duplicate notifications for each. that should be fixed

  3. calmh commented on Jul 22, 2014

    @calmh
    Member

    It's not that simple; #329. The filenames are incorrectly encoded for your platform; you probably got them from someone who created them on a Mac? They need to be renamed in Windows.

  4. endolith commented on Jul 22, 2014

    @endolith
    Author

    The file names were created in Windows Explorer and Windows accepts both filenames without problems:

    2014-07-22 14_30_43-filenames

    Syncthing does not:

    File "filenames\ohm sign Ω.txt" contains non-NFC UTF-8 sequences and cannot be synced. Consider renaming.

    For comparison, BTSync passed the ohm sign to both computers that were synced without complaints, while Dropbox normalized to Omega on both computers without complaints.

  5. calmh commented on Jul 22, 2014

    @calmh
    Member

    The issue isn't the character Ω but the fact that it can be represented in two different ways ("NFC" and "NFD"). It's the same character either way, and syncthing will understand and transmit that character, but not how it was originally encoded. So you could in fact have two files both named omega Ω.txt, but the Ω encoded in two different ways. There is no reasonable way for syncthing to handle this situation, so it refuses to try.

    The "NFC" way is the standard way in Windows and what is produced if you type that key on your keyboard.

  6. calmh commented on Jul 22, 2014

    @calmh
    Member

    Actually no, you're entirely correct - syncthing does expect OHM SIGN (U+2126) to be normalized as GREEK CAPITAL LETTER OMEGA (U+03A9). http://www.fileformat.info/info/unicode/char/2126/index.htm lists that as the "decomposition", but I'm not 100% clear on whether that means OHM SIGN should not be present in UTF8-NFC, although it does also say "preferred representation is U+03A9". This might be a bug, or maybe we should at least be a little less strict. Some investigation required!

  7. reopened this on Jul 22, 2014
  8. calmh commented on Jul 22, 2014

    @calmh
    Member

    Right, so as it stands, this is expected behavior (although I can see that it can be annoying).

    Syncthing expects filenames to be in the standard encoding for the operating system and platform in question. On Windows that means UTF-8 NFC. We do this because we want to be able to translate the name correctly to whatever is expected on the target system, or it'll look like crap there and can potentially cause data loss. For example, here's what happens on my computer if I have a file called Ω (omega) and try to create one called Ω (ohm sign):

    screen shot 2014-07-22 at 22 24 06

    This happens because the Mac filesystem enforces normalized names, much like syncthing does. We do the same for names containing invalid characters (but on the receiving end, since what is considered invalid is very system dependent).

    There won't be any song and dance with replacing characters; what if we rename the file Ω.txt to _.txt, but there already is a _.txt on the other system, etc...

    In this specific case, apparently, consulting http://www.unicode.org/charts/normalization/ (search for 2126) the OHM SIGN should always be encoded as GREEK CAPITAL LETTER OMEGA (U+03A9), so that's what we expect.

  9. endolith commented on Jul 22, 2014

    @endolith
    Author

    They're not the same character, but they are canonically equivalent. Yes, you can create two files named "Ω.txt" and "Ω.txt" in the same folder, on both Windows and Linux. In this case, since Dropbox normalizes them, it converts one filename to "Ω (Unicode Encoding Conflict).txt".

    If the software isn't going to change anything automatically, it should at least point out which character is causing the problem and offer to fix it for you:

    File "100 Ω.txt" cannot be synchronized because name contains non-normalized Unicode character(s) "Ω". Is it ok to rename file using equivalent characters: "100 Ω.txt"?

  10. calmh commented on Jul 22, 2014

    @calmh
    Member

    it should at least point out which character is causing the problem and offer to fix it for you

    Yep!

  11. endolith commented on Jul 22, 2014

    @endolith
    Author

    There won't be any song and dance with replacing characters; what if we rename the file Ω.txt to _.txt, but there already is a _.txt on the other system, etc...

    It should be fine to convert "Ω.txt" (ohm) to "Ω.txt" (Omega), and if "Ω.txt" already exists, make it "Ω (2).txt" or something?

  12. 11 remaining items

  13. lupa18 commented on Nov 13, 2014

    @lupa18

    Yes, It works; but I did it manually. Is there any other way to do it ?

  14. added this to the milestone on Nov 26, 2014
  15. modified the milestones: , on Jan 15, 2015
  16. added a commit that references this issue on Mar 19, 2015
    f568e76
  17. mauro3 commented on Mar 19, 2015

    @mauro3

    What does the automatic fix do to the filenames? Does it rename them to conform to the system standard on syncing? Presumably it does not rename files which are present locally, right?

  18. calmh commented on Mar 19, 2015

    @calmh
    Member

    It renames files that are UTF8 but in the wrong normalization form for the current system, yes. This is something that pretty much only happens when files are moved on USB sticks and similar without conversion between PC and Mac, and when the filenames contain accented characters (or some other special cases).

  19. added a commit that references this issue on Mar 22, 2015
    2bd11ca
  20. added
    frozen-due-to-age
    on Jun 17, 2017
  21. locked and limited conversation to collaborators on Jun 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions