Forum > General

TMemoryStreamUTF8 cannot LoadFromFile

<< < (2/9) > >>

marcov:
Afaik on all *nix, the apis don't transcode filenames, you get them binary as written in the filesystem directory structure.

But if you then have filesystems with differing encodings (e.g. freebsd native utf8, and Windows some ansi encoding), you have a problem.

The best bet is to look into mount options for the said SMB share, and see if you can fix the encoding the FS driver gives to the kernel on that end.

martinrame:
Hi, the locale is this:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---LANG=en_US.UTF-8LC_CTYPE="en_US.UTF-8"LC_COLLATE="en_US.UTF-8"LC_TIME="en_US.UTF-8"LC_NUMERIC="en_US.UTF-8"LC_MONETARY="en_US.UTF-8"LC_MESSAGES="en_US.UTF-8"LC_ALL=
The smb filesystem is mounted specifying this encodings (in /etc/nsmb.conf):


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---charsets=utf-8:iso-8859-1
That means, the local filesystem is UTF8, and the remote (Windows) is ISO-8850-1.

martinrame:

--- Quote from: PascalDragon on June 14, 2022, 08:57:57 am ---
--- Quote from: martinrame on June 13, 2022, 11:02:05 pm ---The fpc program is a CGI, which runs in a FreeBSD system.
--- End quote ---

Make sure that your main program uses either cwstring or fpwidestring. If that's not enough please provide the output of the locale (at least I hope that also exists on FreeBSD).

--- End quote ---

Hi PascalDragon, how can I tell which type of strings?.

PascalDragon:

--- Quote from: martinrame on June 14, 2022, 12:38:00 pm ---
--- Quote from: PascalDragon on June 14, 2022, 08:57:57 am ---
--- Quote from: martinrame on June 13, 2022, 11:02:05 pm ---The fpc program is a CGI, which runs in a FreeBSD system.
--- End quote ---

Make sure that your main program uses either cwstring or fpwidestring. If that's not enough please provide the output of the locale (at least I hope that also exists on FreeBSD).

--- End quote ---

Hi PascalDragon, how can I tell which type of strings?.

--- End quote ---

This is not about types of strings. You need to put either cwstring or fpwidestring into the uses-clause of your main program (first place; second or third if you also use cthreads and/or cmem).

The locale output looks good, FPC should detect that as UTF-8 then (as long as you use either cwstring or fpwidestring).

martinrame:
Thanks PascalDragon, but unfortunately using
--- Quote ---cwstring
--- End quote ---
or
--- Quote ---fpwidestring
--- End quote ---
doesn't change the result.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version