Wednesday, December 6, 2017

Re: bad display of output utf-8 chars

On Wed, Dec 6, 2017 at 3:29 PM, Ni Va <nivaemail@gmail.com> wrote:
> Le mercredi 6 décembre 2017 01:39:33 UTC+1, Tony Mechelynck a écrit :
>> It seems that Vim doesn't recognise the charset in which Robocopy
>> wrote its output. For instance, it seems that the letter é (small
>> latin letter e with acute) is represented by 0x82 while in Latin1 it
>> would be 0xE9 (and therefore in Unicode it would be codepoint U+00E9,
>> represented in UTF-16le as E9 00 or in UTF-8 as C3 A9).
>>
>> Can you find out which code page is set in your locale (or "country
>> parameters" or whatever Windows calls it)? For instance, if it is
>> (let's say) code page 850, you can maybe open the file in Vim by means
>> of the command
>>
>> :view ++enc=cp850 filename.txt " readonly
>> or
>> :e ++enc=cp850 filename.txt " read-write
>>
>> replacing of course "filename.txt" by the actual name (and path, if
>> necessary) of the file. Similarly with another value after =cp if it
>> is another code page.
>>
>> See ":help ++opt" for details.
>>
>>
>> Best regards,
>> Tony.
>>
>> On Tue, Dec 5, 2017 at 5:31 PM, Ni Va <nivaemail@gmail.com> wrote:
>> > Hi,
>> >
>> > I use gvim 8.0.136x under windows 10 and got a bad display of output of robocopy tool.
>> >
>> >
>> >
>> > How can I fix it ?
>> > Thank you
>> > Nicholas
>> >
>> > --
>> > --
>> > 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.
>
> Hi Tony,
>
> In fact, I launch it through a job_start('robocopy "srcpath" "destpath" *.ico', out_cb).So, I get output of robocopy from my own out_cb job function.
>
> So how can I set the <good encoding charset> dealing with out of job_start call ?
>
> Nota : Even from microsoft knowledge, it's difficult to know which charset robocopy used. I've read that it can depend to the charset of executable cmd, or system.

Well, the "system" charset should be set in your "country settings",
or something, but it's been years and years since I left Windows (XP
SP4) for Linux, and I can't check it here.

On a Unix-like system you would set the LC_CTYPE environment variable
to the desired locale (such as fr_FR.UTF-8) before starting the
program, and that would be that; maybe setting ":language ctype
fr_FR.UTF-8" would be enough; but Windows is decidedly non-Unix-like
and doesn't work the same way. Assuming that you have set 'encoding'
to UTF-8 in your vimrc, you might try something like ":language ctype
French_France.10646", or something, before starting the job, but I'm
not sure of the settings to use for Windows (maybe ":language ctype"
with no furter argument might help you), and I'm not sure of which
Windows "code page" means UTF-8, or at least some Unicode encoding
with BOM. You might fall back on 1252 for the codepage (the value
after the dot) when starting Robocopy (but come back to UTF-8
immediately afterwards): that codepage corresponds to the charset
known internationally as "Windows-1252", it is an 8-bit encoding very
similar to Latin1 — the Windows salespeople claim that it is what
Latin1 ought to be, or sometimes they even gloss over the difference,
which concerns only characters 0x80 to 0x9F: these are rarely-used
controls in "true" Latin1 but in Windows-1252 they are additional
printable characters, including among others the Euro sign and IIRC
the œ and Œ digraphs.

Best regards,
Tony.

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

Post a Comment