Re: Null character handling
- Ben Siemerink wrote:
> There are two peculiarities I want to bring up:The problem is that NL (ascii 10) is a newline in a Vim script string
>  nr2char(0) does not yield the internal representative of the null
> character. Rather, nr2char(10) must be used. To me this is a bug.
and a NUL in a line of the file. Thus it depends what you use it for.
This can't be changed now without causing lots of incompatibilities.
I'll add a remark about this at the docs for nr2char().
>  When sourcing a Vim file, ^@ is not interpreted as the internalAgain, this depends on where you use it and can't be changed without
> representative of the null character, but rather as an end-of-string. To me
> this is also a bug.
becoming incompatible with previous versions.
> Does everybody agree that, from a user point of view, these are bugs?Unfortunately you do have to know about this when writing Vim scripts.
> A user should not need to know that the null character is internally
> stored as a 0x0a, not even an advanced user.
Also in search strings, for example.
From "know your smileys":
% Bike accident (a bit far-fetched, I suppose)
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///