Monday, May 7, 2018

Re: bad display of output utf-8 chars

Le vendredi 8 décembre 2017 11:46:20 UTC+1, Ken Takata a écrit :
> Hi,
>
> 2017/12/8 Fri 1:02:09 UTC+9 Tony Mechelynck wrote:
> > On Thu, Dec 7, 2017 at 3:44 PM, Ni Va <nivaemail@gmail.com> wrote:
> > > Le jeudi 7 décembre 2017 00:59:53 UTC+1, dwierenga a écrit :
> > >> On Wed, Dec 6, 2017 at 3:18 PM, Ni Va <niva...@gmail.com> wrote:
> > >> Yes thank you Tony and Mr Gentis,
> > >>
> > >>
> > >>
> > >> Enter chcp under windows console return 850 so you're right Tony.
> > >>
> > >> So i can try to redirect robocopy's output even if it is so far of my idea ( getting output data live at runtime)
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> robocopy.exe has an explicit /UNICODE flag to control the output encoding. You may want to try that before re-architecting your process to deal with redirected output.
> > >
> > >
> > > For the moment it works with my output showmessages func fixed.
> > >
> > > function! sequencerutil#showmessages() abort " {{{
> > > let debug_file=tempname()
> > > exe 'redir! > ' . debug_file .'|silent messages|redir END'
> > > call setqflist(readfile(debug_file))
> > > set encoding=cp850
> > > copen
> > > endfunc "}}}
> > >
> > >
> > >
> > > Nota : /UNILOG option causes errors combined with /MIR that I need
> >
> > Changing 'encoding' anywhere other than your vimrc (which is sourced
> > before loading the first editfile) can have disastrous results,
> > because it changes how the contents of all text in Vim memory is
> > interpreted but it doesn't reload any files already in memory. If at
> > that moment you already have another file loaded (a help file, maybe:
> > some of them, including options.txt for the 'langmap' example, are in
> > "true" UTF-8) it could become hopelessly garbled.
> >
> > Alas, ":copen" doesn't accept a ++enc modifier.
>
> Sorry, I don't follow the discussion, but if you use `:grep`, `:make` or
> some other commands, you can use the 'makeencoding' option to set the
> encoding for those commands. (If you use recent versions of Vim.)
>
> If you use setqflist() to set qflist, you may want to use iconv() to
> convert the encoding.
> E.g.
>
> call setqflist(iconv(readfile(debug_file), 'cp1252', &encoding))
>
> Maybe you can also try &termencoding or 'char' instead of 'cp1252'.
>
> Regards,
> Ken Takata

Hi,

Sorry for the late responding.

I confirm launching robocopy /tee under windows from job_start use encoding cp850 and can be convert by that :


function! s:out_cb(channel, message) dict "{{{
" 1.
call writefile([a:message],s:debug_file,"a")
call setqflist(split(iconv(string(readfile(s:debug_file)), 'cp850', &encoding)))

" 2.
call sequencerutil#echomsg(s:start, iconv(a:message, 'cp850', &encoding))
....

1. direct message retrieved from out_cb method
2. if a file has been written

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: