The comments in here may be of help:https://github.com/postgres/postgres/blob/master/src/include/mb/pg_wchar.h
Kind regards
Peter