Kimmi
Kimmi

Reputation: 601

Samba share encoding with UTF-8 issue

I use samba to share folder between Ubuntu and Windows. And here comes the problem that I want to use UTF-8 encoding in both Linux and Windows.

However, when I forced to encode file with UTF-8 in windows, I check the encoding in Linux, it said it was ASCII.

It automatically encoded both files and folders in Ubuntu with ASCII.

How to fix it? How to write samba configure file? /etc/samba/smb.conf ?

I want both windows and Ubuntu encode with UTF-8.

Upvotes: 3

Views: 19070

Answers (2)

Valarauca
Valarauca

Reputation: 1141

I want both windows and Ubuntu encode with UTF-8.

You may think you want this, but you don't. Try

dos encoding = UTF16

Why

Natively Microsoft Windows has used USC-2/UTF-16 (since Windows NT circa 1993), so you don't need to fall back to ancient code page unless you're talking to Windows95/98 hosts, which at time of posting ( Anno Domin 2025) is unlikely.

UTF-8 has been supported since Windows 10, but internally UTF-8 is converted to UTF-16. Windows UTF-8 support is a little flaky. It doesn't have full adoption across the entire windows API. UTF-16 is preferred where possible.

When you look at other implementations of Server Message Block Protocol that are designed to interface with Microsoft Windows, namely IBM's Unix implementation of SMB (AIX's SMB server). It prefers to operate in UTF-8 natively (and when communicating with unix hosts) but when communicating with Microsoft products, it will send/receive text in UTF-16 ( citations: v7.1 v7.2 v7.3).

I'd suggest checking if your version of sambda supports something like: UTF16, UTF16LE, or UCS2LE with testparams.

Please Note: There are other ways for paths to get mangled.

Upvotes: 0

Green Root
Green Root

Reputation: 704

Try in /etc/samba/smb.conf, global section:

dos charset = cp866
unix charset = UTF8
display charset = UTF8

Upvotes: 10

Related Questions