Why can’t I upload files with file names of more than 83 Chinese characters (or more than a certain number of other characters)?
Applicable Products
- QTS NAS series
Root Cause
The maximum file name length (including file extension) is limited to 255 bytes under the ext4 file system on the QNAP NAS.
A regular Chinese character takes up 3 bytes in UTF-8 encoding, therefore 84 regular Chinese characters are 252 bytes. A file extension of 3 letters adds 4 more bytes (e.g., ‘.txt’, which has 1 byte per ASCII character including the dot), making the result 256 bytes that is1 byte over the limit.
Details
The number of bytes per character may vary between different character sets for different languages, as well as within a language (e.g., some special Chinese characters require 4 bytes). And because file extensions can also contain fewer or more than 3 letters, the actual character limit may vary on a case-by-case basis.