pg_ls_dir and files with local characters - Mailing list pgsql-sql

From Magnus Johansson
Subject pg_ls_dir and files with local characters
Date
Msg-id MRWPR01MB125758330358214208035A031AF592@MRWPR01MB12575.eurprd01.prod.exchangelabs.com
Whole thread Raw
List pgsql-sql
Hello, I have a question regarding pg_ls_dir 
I have a directory structure on my windows server (2025) where I run postgres 18

Some of the files listed has Swedish characters in the name.
Like this: Stocksnäsvägen-36-Stocksnäsvägen-36-Noah.pdf

When I run pg_ls_dir on that directory it is listed as this 

SELECT * FROM pg_ls_dir('E:\Digpro\Bilder\Dokument\200891');
                  pg_ls_dir
----------------------------------------------
 Stocksnasvagen-36-Stocksnasvagen-36-Noah.pdf
(1 rad)

My Swedish characters are changed to a, sometimes they disapear...

Done some research and I verified that the server and client encoding are the same 

dps=# show server_encoding;
 server_encoding
-----------------
 UTF8

dps=# show client_encoding;
 client_encoding
-----------------
 UTF8

I have set codepage to utf8 in cmd prompt , chcp 65001

Suspect that this is Windows related, but cannot figure out what to change
Region settings has Swedish (Sweden) as preferred language and only language


I also have a ubuntu server with PG18, if I run the same example there the Swedish characters
Are presented properly. Encoding in PG is UTF8


Appreciate any comments on this.



Best Regards
--
Magnus Johansson

pgsql-sql by date:

Previous
From: Krzysztof
Date:
Subject: Re: Linux file permission for COPY TO SQL command