libsmbclient and special characters not in us-ascii

Jostein Tveit Jostein.Tveit at
Fri Nov 2 06:13:06 GMT 2001

I use libsmbclient (from samba-2.2.2) to access samba shares, but when I
try to access directories and files with special norwegian characters like
«æ» (ae ligature), «ø» (o slash) and «å» (a ring) i get en error. Other
characters outside the US-ASCII seems to give error too.

This problem is not present in smbclient from the command line.

Here are the relevant parts of my program:
set_fn("SINGSING", "test", " ");
smbc_init(auth_fn, 0);

dir = "smb://snoop/rap/test";
dh = smbc_opendir(dir);
fprintf(stderr, "Open %s : %s\n", dir, strerror(errno));

while (a = smbc_readdir(dh))


And the output:
[josteitv at snoop samba]$ ./a.out 
Open smb://snoop/rap/test : Success
h ppsann
p ss

The spaces are actually control characters if i cut and paste them into

Here is the output from smbclient, which displays the characters right:
[josteitv at snoop josteitv]$ smbclient //snoop/rap -N -D/test -c ls
added interface ip= bcast= nmask=
Got a positive name query response from ( )
Domain=[SINGSING] OS=[Unix] Server=[Samba 2.0.10]
  .                                   D        0  Thu Nov  1 00:31:22 2001
  ..                                  D        0  Thu Nov  1 00:31:10 2001
  håppsann                            D        0  Thu Nov  1 00:31:10 2001
  püss                                D        0  Thu Nov  1 00:31:22 2001

                63467 blocks of size 262144. 2162 blocks available

If i try to access the directories from libsmbclient with 
dir="smb://snoop/rap/test/håppsann" I get an error:
Open smb://snoop/rap/test/håppsann : No such file or directory

Anyone who knows if this is a problem with libsmbclient, or something I'm
doing wrong?

Jostein Tveit (Jostein.Tveit at

More information about the samba-technical mailing list