[NTG-context] new hash for buffer (as file)

Hans Hagen j.hagen at freedom.nl
Mon Sep 26 10:47:58 CEST 2022


On 9/26/2022 2:05 AM, Max Chernoff via ntg-context wrote:
> 
> Hi Pablo,
> 
>> 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?
> 
> I'm not too sure what you're asking here, but Notepad was somewhat-
> recently updated to handle both CRLF and LF line endings:
> 
>     https://devblogs.microsoft.com/commandline/extended-eol-in-notepad/
>     
> But I do agree that the line ending handling seems a little odd. I find it
> surprising that the buffers internally use CR line endings since no systems
> in the past 20 years use that.

how about tex ...

\number\endlinechar
\number\numexpr`M-`A+1\relax % plain sets up `^^M

... you don't want to know how much hassle dealing with line endings in 
tex is

> Also, you should probably check to make sure that the results of the
> file don't depend on the current code page on Windows. Try writing out a
> buffer from ConTeXt with the following contents:
> 
>     АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя
>     
> First, run "chcp 65001" before running "context" and record the size of the
> file written. Then, run "chcp 1251" and run "context" again. Hopefully the
> file size doesn't change; but if it does, then that means that the binary
> content of any file written will depend on the system's default code page,
> which would complicate making reproducible hashes.
if that were the case nothing would work .. so it's bytes in - bytes out

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list