lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Feb 27, 2010 at 8:03 AM, JM Fernandez <elcubion@gmail.com> wrote:
> I have a file encoded in iso-8859-1 but I want to show it at the screeen
> in the charset used by the os (after convert it in some way), let say utf-8.
>
> Is there some way to detect from Lua the charset used by the OS to
> proceed adequately? (probably in Linux, Windows and Mac the way,
> if exists, is different).

Linux and Mac both have unix terminals, who knows about Windows.

Why not pass it to a pager and let it deal with this for you, like
/usr/bin/less?

os.execute("LESSCHARSET=latin1 /usr/bin/less -F -E"..your_file)

Then only windows would have to special, unless you have less there,
you might have
to use more.

Sam