On 9/23/22 17:06, Pablo Rodriguez via ntg-context wrote:
> On 9/23/22 06:01, Max Chernoff via ntg-context wrote:
>> […]
>>            return utilities.sha2.hash256(
>>                str:gsub(string.char(0x0D), string.char(0x0A))
>>            )
> […]
> this works perfectly fine with Linux "str:gsub('\r','\n')", but I can’t
> make it work in Windows.

Hi again Max,

this seems to solve the issue in Windows too:

  just a test
  and another one


  function sha256(str)
    if os.name == "windows" then
      return utilities.sha2.hash256(str:gsub("\r", "\r\n"))
      return utilities.sha2.hash256(str:gsub("\r", "\n"))




  \savebuffer[test][temporary-αβγ, prefix=no]



But now I don’t understand is the following issue: if the saved file
contains "\r\n", why does basic Notepad the new lines?

"\r\n" are the chars to get new lines in Windows. Or what am I missing here?

Many thanks for your help,

If your question is of interest to others as well, please add an entry to the 

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net

Reply via email to