Bit off the wall, but perhaps we should provide a py3 api something like 
`vim.eval_bytes()` returning a `bytes` instance rather than trying to 
decode the evaluated bytes into a (unicode) `str` object. In the general 
case a vim string variable can contain any bytes (except NUL?); to read 
that into a python object, we have to decode it, but if it's just a 
variable with no context, we can't assume that it's encoded in any 
particular way.

I believe that's actually what happens what you access `vim.vars` - you get 
a `bytes` instance:

i.e. doing "let g:test = 'byte me'" and then
* Ctrl-r= py3eval( 'vim.eval( "g:test" )' )
* Ctrl-r= py3eval( 'type( vim.eval( "g:test" ) ).__name__' )
and
* Ctrl-r=py3eval( 'vim.vars[ "g:test" ]' )
* Ctrl-r=py3eval( 'type( vim.vars[ "g:test" ] ).__name__' )

```
Eval: byte me
  Type: str

vim.vars: byte me
  Type: bytes
```

This would push he burden of the decoding on to the script author, who may 
have better knowledge of what the variable contains (encoding wise) ?

Just a thought.
On Monday, December 21, 2020 at 7:25:11 PM UTC Bram Moolenaar wrote:

> Reopened #1053 <https://github.com/vim/vim/issues/1053>.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub 
> <https://github.com/vim/vim/issues/1053#event-4137321909>, or unsubscribe 
> <https://github.com/notifications/unsubscribe-auth/ACY5DGBFAZSSBRDPZ6W63ATSV6OAVANCNFSM4CPHGRIQ>
> .
>

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/793cf800-a95b-40fe-9c30-4ee652a08e83n%40googlegroups.com.

Raspunde prin e-mail lui