luatex problem with file with umlauts on windows 10
Akira Kakuto
kakuto at w32tex.org
Sat Apr 25 23:42:38 CEST 2020
Dear Ulrike,
> I tried with some chinese (at least I think it is chinese). And
> there is breaks again: the file is input but lfs reports nil:
Sorry. I'm not using true Unicode programing, only a workaround.
Here on Japanese windows, kanji, hiragana etc. work.
Note that, more confusingly, the behavior of texlua is not changed
for compatilility with many existing scripts:
-- an example of texlua script
-- for texlua, UTF-8
kpse.set_program_name('kpsewhich')
local function is_texlive()
local a = kpse.var_value('command_line_encoding')
if a then
return true
else
return false
end
end
local function is_windows()
if os.type == 'windows' then
return true
else
return false
end
end
function myfilesize(name)
-- In the case of texlua, kpse can't find UTF-8 name
-- and only can find ANSI name with local code page,
-- for compatibility with many existing scripts.
-- Command line is not changed to UTF-8.
-- Return value is also ANSI name with local code page.
-- If name is in UTF-8, we have to change it to local code page.
if is_windows() and is_texlive() then
local nname = chgstrcp.utf8tosyscp(name)
name = nname
end
local file = kpse.find_file(name, "tex", true)
print("\nFILE: ",file)
if file then
local size = lfs.attributes(file, "size")
local isfile= lfs.isfile (file)
print("SIZE: ",size)
print("isfile ", isfile)
end
end
myfilesize("grüße.tex")
Best,
Akira
More information about the tex-live
mailing list.