UFT-8 and illegal sequences

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

UFT-8 and illegal sequences

Patrick Texier

I'm Using gVim 7.1.293 (huge with multibyte_ime/dyn, iconv/dyn...) on
Windows.

I'm using the following _vimrc.
====== _vimrc ==========
if has("multi_byte")
        if &enc !~? '^u'
                if &tenc == ""
                        let &tenc = &enc
                endif
                set enc=utf-8
        endif
        set fencs=ucs-bom,utf-8,latin1
        lan fr_FR.UTF-8
endif " }}}
==========================

I want call gVim from an external program (LifeLines) with a UTF-8 BOM
temporary file but a can have illegal UFT-8 like :

1 FAMS @F16797@ {{(F16797) 1h,1w,0ch, B de Talleyrand-PÃ m. A. Morel }}
                                                       !
                                  é without 2nd byte --+
I get :

enc=uft-8
fenc=latin1 (and not utf-8)

I want to force fenc to uft-8 but the following calling command doesn't
work :

c:\vim\vim71\gvim.exe -c"++enc=utf-8" -f
c:\vim\vim71\gvim.exe -c"set fencs=utf-8" -f

0 @I41085@ INDI
1 NAME Boson /de Talleyrand-Périgord/
--
 Patrick Texier

 vim:syntax=mail:ai:ts=4:et:tw=72

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: UFT-8 and illegal sequences

Tony Mechelynck

On 06/05/08 12:27, Patrick Texier wrote:

> I'm Using gVim 7.1.293 (huge with multibyte_ime/dyn, iconv/dyn...) on
> Windows.
>
> I'm using the following _vimrc.
> ====== _vimrc ==========
> if has("multi_byte")
> if&enc !~? '^u'
> if&tenc == ""
> let&tenc =&enc
> endif
> set enc=utf-8
> endif
> set fencs=ucs-bom,utf-8,latin1
> lan fr_FR.UTF-8
> endif " }}}
> ==========================
>
> I want call gVim from an external program (LifeLines) with a UTF-8 BOM
> temporary file but a can have illegal UFT-8 like :
>
> 1 FAMS @F16797@ {{(F16797) 1h,1w,0ch, B de Talleyrand-PÃ m. A. Morel }}
>                                                         !
>                                    é without 2nd byte --+
> I get :
>
> enc=uft-8
> fenc=latin1 (and not utf-8)
>
> I want to force fenc to uft-8 but the following calling command doesn't
> work :
>
> c:\vim\vim71\gvim.exe -c"++enc=utf-8" -f
> c:\vim\vim71\gvim.exe -c"set fencs=utf-8" -f
>
> 0 @I41085@ INDI
> 1 NAME Boson /de Talleyrand-Périgord/

'fileencodings', no matter what you set it to, will never detect a file
as UTF-8 if it contains invalid UTF-8 sequences.

To force opening as UTF-8, try (after setting 'enc' to utf-8, see
http://vim.sourceforge.net/scripts/script.php?script_id=789 )

        :e ++enc=utf-8 foobar.txt

(replacing, of course, foobar.txt by the filename), see ":help ++opt".

WARNING: Any invalid bytes will be replaced by ? (question mark, 0x3F).


Best regards,
Tony.
--
        Overheard in a bar:
Man: "Hey, Baby, I'd sure like to get in your pants!"
Woman: "No, thanks, I've already got one ass-hole in there now."

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: UFT-8 and illegal sequences

Patrick Texier

Le Tue, 06 May 2008 12:55:10 +0200, Tony Mechelynck a écrit dans le
message <[hidden email]> :

> To force opening as UTF-8, try (after setting 'enc' to utf-8, see
> http://vim.sourceforge.net/scripts/script.php?script_id=789 )
>
> :e ++enc=utf-8 foobar.txt
>
> (replacing, of course, foobar.txt by the filename), see ":help ++opt".

Thanks Tony. I'm using

:e! ++enc=uft-8

> WARNING: Any invalid bytes will be replaced by ? (question mark, 0x3F).

All invalid bytes are in comments between {{ ... }} and not written in
database.

1 FAMS @F16797@ {{(F16797) 1h,1w,0ch, B de Talleyrand-PÃ m. A. Morel }}

I will report (for fix) this LifeLines bug.
--
Patrick Texier,
Frulon, 36190 Orsennes, France (46°31'N, 01°41'E)
<http://www.genindre.org>
<http://www.gpsql.org> <http://www.footsql.org>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---