[NTG-context] new hash for buffer (as file)
Hans Hagen
j.hagen at freedom.nl
Mon Sep 26 20:07:46 CEST 2022
On 9/26/2022 7:24 PM, Pablo Rodriguez via ntg-context wrote:
> On 9/26/22 02:05, 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/
>
> Hi Max,
>
> I realized later that I was doing something wrong. My fault here.
>
>> [...]
>> 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.
>
> For more than two decades, all my TeX sources are written in UTF-8.
>
> I thought that ConTeXt would output the same character encoding as in
> the source file when saving a buffer.
>
> I haven’t found this issue and I’d say that all my saved buffers are
> UTF-8 encoded.
the magic is in
savedata(name,replacenewlines(content),"\n",option == v_append)
because tex reads in and then lost what it saw (cr lf crlf) we use the
line endings of the operating system (good old typewriters and windows
use cr+lf and old macs uses cr while linux uses lf)
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