[GH-ISSUE #185] Encoding issues in plain text files #88

Closed
opened 2026-04-08 16:50:16 +03:00 by zhus · 2 comments
Owner

Originally created by @physanus on GitHub (Feb 27, 2023).
Original GitHub issue: https://github.com/sigoden/dufs/issues/185

Problem
When creating a new UTF-8 encoded file with the content äöüß and browsing it via dufs, the browser shows äöüß. On the command line, everything is normal.

$ file README.txt
README.txt: Unicode text, UTF-8 text
$ cat README.txt
äöüß
$ curl https://xxx.tld/yyy/zzz/README.txt
äöüß

When I manually set the page encoding on the client side to UTF-8, everything is normal again. However, I couldn't figure out how to do this server sided.

Log
n/a

Environment:

  • Dufs version:
    • Docker sigoden/dufs:v0.32.0
    • Docker sigoden/dufs:v0.30.0
      Both via an nginx reverse proxy
  • Browser/Webdav Info:
    • Chrome: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
    • Firefox: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
    • Also happens on Android
  • OS Info:
    • Server - Ubuntu 22.10 (Kinetic Kudu) / 22.04.2 LTS (Jammy Jellyfish)
    • Client - Windows 11 Pro - 22H2 / Android
Originally created by @physanus on GitHub (Feb 27, 2023). Original GitHub issue: https://github.com/sigoden/dufs/issues/185 **Problem** When creating a new UTF-8 encoded file with the content `äöüß` and browsing it via dufs, the browser shows `äöüß`. On the command line, everything is normal. ``` $ file README.txt README.txt: Unicode text, UTF-8 text $ cat README.txt äöüß $ curl https://xxx.tld/yyy/zzz/README.txt äöüß ``` When I manually set the page encoding on the client side to UTF-8, everything is normal again. However, I couldn't figure out how to do this server sided. **Log** n/a **Environment:** - Dufs version: - Docker `sigoden/dufs:v0.32.0` - Docker `sigoden/dufs:v0.30.0` Both via an nginx reverse proxy - Browser/Webdav Info: - Chrome: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36` - Firefox: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0` - Also happens on Android - OS Info: - Server - `Ubuntu 22.10 (Kinetic Kudu)` / `22.04.2 LTS (Jammy Jellyfish)` - Client - `Windows 11 Pro - 22H2` / `Android`
zhus closed this issue 2026-04-08 16:50:16 +03:00
Author
Owner

@sigoden commented on GitHub (Feb 27, 2023):

dufs just returns the content as-is.
There is no way to accurately detect encoding of a text file.
dufs can't do anything about it.

<!-- gh-comment-id:1446144552 --> @sigoden commented on GitHub (Feb 27, 2023): dufs just returns the content as-is. There is no way to accurately detect encoding of a text file. dufs can't do anything about it.
Author
Owner

@physanus commented on GitHub (Feb 27, 2023):

Totally correct. I added this to my nginx configuration in the server-block:

charset utf-8;
source_charset utf-8;

Works as expected now. Thank you!

<!-- gh-comment-id:1446319897 --> @physanus commented on GitHub (Feb 27, 2023): Totally correct. I added this to my nginx configuration in the server-block: ``` charset utf-8; source_charset utf-8; ``` Works as expected now. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#88