Wednesday, October 31, 2012

Re: readfile( return on column instead of lines of file

On Wed, October 31, 2012 10:34, niva wrote:
> Le mercredi 31 octobre 2012 09:55:35 UTC+1, niva a écrit :
>> Hi, I would like to store lines of file into a List then I have used
>> readfile(. When I open this file by :read command, the file appears
>> correctly with many lines. When I use readfile(, the list return is
>> composed of each character of each line of the file. I don't understand
>> why? thank you for help
>
> The file contains that:
> BEGIN OUT OF FILE
> Bit 1 : FOO
> END OUT OF FILE
>
> The readfile( in a loop show that:
>
> ÿþB
> i
> t
>
> 1
>
> :
>
> F
> O
> O
>

Readfile does not detect the encoding and convert your utf16le
encoded file into utf-8 butsimply reads byte by byte.

In your utf16le encoded file, it will replace the NULs by "\n".

I suggest to save/encode your tags file into utf8 format, before using
readfile()


regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment