lua-users home
lua-l archive

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


In my continuing saga of PDF’s and raster images, I need to translate names (like John Smith) from ASCII to EBCDIC. Thus ‘Abcd’ (hex => X’41626364’) would become X’C1828384’.

 

Usually this is done with a table lookup, i.e. the character to be translated is used as a binary offset into a 256 byte table of the translated characters. Thus at position X’41’ in this table would be x’C1’ facilitating the translation of the ASCII ‘A’ into its EBCDIC equivalent. How does one go about doing this in Lua?