Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-09 Thread Jane Taubman
Thank you, I will give it try when the app I use adopts the new release. On Fri, 8 May 2020, 15:16 Andrew Robinson, wrote: > Nice. > > On 2020-05-08 at 6:42 AM, Antonio Scuri wrote: > > Ok. > > I had an idea. Just added a new attribute for IupClipboard: > > FORMATDATASTRING [Windows and GTK

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-08 Thread Andrew Robinson
Nice. On 2020-05-08 at 6:42 AM, Antonio Scuri wrote: Ok. I had an idea. Just added a new attribute for IupClipboard: FORMATDATASTRING [Windows and GTK Only]: sets/gets FORMATDATA and FORMATDATASIZE considering data being a string in the system format. (since 3.29) Best, Scuri Em

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-08 Thread Antonio Scuri
Ok. I had an idea. Just added a new attribute for IupClipboard: FORMATDATASTRING [Windows and GTK Only]: sets/gets FORMATDATA and FORMATDATASIZE considering data being a string in the system format. (since 3.29) Best, Scuri Em qui, 7 de mai de 2020 06:32, Jane Taubman escreveu: > I get

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-07 Thread Jane Taubman
I get the plain text, excluding the html code.When you copy from a web browser like Chrome you get several different formats. So if I copy your post from gmail the TEXT is - What happen if you simply try using: script = clipboard.text instead

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-04 Thread Antonio Scuri
What happen if you simply try using: script = clipboard.text instead of script = clipboard.formatdata Leaving the rest as it is. Best, Scuri Em seg., 4 de mai. de 2020 às 13:41, Jane Taubman escreveu: > I'll try to explain in a clearer way. > > If I open a file saved in UTF-16 in Lu

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-04 Thread Jane Taubman
I'll try to explain in a clearer way. If I open a file saved in UTF-16 in Lua using the IO library. I can then handle the content of that file to convert each pair of bytes as needed to end up with UTF-8 or even Ascii. All I want to do is to be able to read in the text/html format from the clip

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-03 Thread Andrew Robinson
I hate to state the obvious but in a string data type, an ASCII "character" is one byte in size (char), and a UTF-16 "character" is two bytes in size (short). I apologize if this is out-of-place for your conversation, but I get a lot of people who confuse a string character with a byte, instead o

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-03 Thread Antonio Scuri
> The UTF-16 function takes a "string" That is weird. UTF-16 strings are *unsigned short** arrays, strings in Lua are *char** arrays. Something is not right. Is there a link for the documentation of that library? Best, Scuri Em dom., 3 de mai. de 2020 às 09:02, Jane Taubman escreveu: >

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-05-03 Thread Jane Taubman
>"data" can not be converted to a string using "tostring". It must use this function you mentioned. Sorry I did not make myself clear.The UTF-16 function takes a "string" and will not work with a "light user data" so I need to know how to convert the light user data from the iup.clipboard

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-04-30 Thread Antonio Scuri
hi, > I have a function to convert UTF-16 to UTF-8 if I can get the whole string back to a variable. "data" can not be converted to a string using "tostring". It must use this function you mentioned. Assuming that 'text/html' is returned as UTF-16. What's the UTF-16 representation in Lua for

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2020-04-29 Thread Jane Taubman
On Tue, 25 Jun 2019 at 15:18, Antonio Scuri wrote: > It will be returned as a light user data. Then you can use your > conversion functions. > I have finally returned to this one and now need to process the lightuserdata in Lua, I tried to use the tostring() option to get the string out of t

Re: [Iup-users] Lua, UTF-16 and iup.clipboard

2019-06-25 Thread Antonio Scuri
Hi, That was a bug. FORMATDATA is not a string, and it was being returned as a string. Thanks for pointing that out. Just fixed and committed to the SVN. As a workaround you can do: script = iup.GetAttributeData(clipboard, "FORMATDATA") It will be returned as a light user data. Then you

[Iup-users] Lua, UTF-16 and iup.clipboard

2019-06-25 Thread Jane Taubman
I am using Lua 5.3 IUP 3.26 I am trying to get the HTML text from the clipboard using require "iuplua" local clipboard = iup:clipboard() local script clipboard.format = 'text/html' if clipboard.formatavailable == 'YES' then script = clipboard.formatdata print(clipboard.FORMATDATASIZE)