SMB external storage and codepage cp1251


I installed OwnCloud on Freebsd 12.
Server has locale equal ru_RU.CP1251

I connected external storage SMB. Server Samba 4.8. Samba has unix charset=cp1251

Issue 1. If directory contains directories with cyrillic name, they are not displayed.
Example on screen

Code in file NativeState.php get right name.
Example: function readdir($dir) has code “$result = @smbclient_readdir($this->state, $dir);”
$result[‘name’] equal ‘newfolder’, then equal ‘новый’ in codepage cp1251.
But further … :slight_smile:
How to teach owncloud to read smb external storage in codepage cp1251?


My recomendation is to set everything to use utf8. This should give you less problems.

As far as I know, ownCloud doesn’t change the charset in any place. The problem might be that listing the name, which is done via webdav, is being served as xml with utf8 charset. If the filenames use other charset, I guess the browser gets confused.
I don’t know if this can be changed at the moment.


Thank you. I think so too :slight_smile:
This server has histhistorically codepage cp1251. And I don’t really want to convert these terabytes.
Now probe another server. It has codepage utf8 and same samba.

I saw this detail.


I finished the experiment.
Server has locale utf8.
Samba has option unix charset = utf8
Owncloud save directory. Name has codepage utf8.
Windows wait at the other end the name in the encoding codepage cp1251 :frowning:
I began to see smbclient.c in libsmbclient-php :wink:


I changed smbclient.c from libsmbclient-php.
The chain of pre-transforms looks like this: ownCloud (utf8 -> urlencode) -> libsmbclient-php (urldecode -> utf8_to_cp1251 -> urencode) ->smbclient (samba4)
Otherwise, nothing happens :slight_smile: