Re: SNR, maparg(), and UTF-8

2006-05-22 Thread Luc Hermitte
Hello,

* On Wed, May 17, 2006 at 08:13:05PM +0200, A.J.Mechelynck [EMAIL PROTECTED] 
wrote:
 The problem has existed for a long time. The iconv() workaround
 works correctly with vim 7.0.012 on linux, but not with vim 7.0.000
 (default win32 build) on windows.
   
 Do you have +iconv or +iconv/dyn in :version? For better work with
 various encodings you need iconv.dll in some readable place.
 
 
 On windows build, I have +iconv/dyn IIRC. As it is the standard build
 from sourceforge, I guess the DLL is correctly provided -- I'll check
 that tomorrow.
 Can the function iconv() continue to transform characters without the
 DLL ?
 
 Without iconv.dll, Vim can only convert between UTF-8 and Latin1 (see 
 :help iconv()).
 
 To see if the +iconv feature is currently available, use :echo 
 has('iconv') (without the double quotes but with the singole quotes). 
 The answer should be 1 (you've got it) or 0 (you haven't).

   :echo has(iconv)
returns 1.

I guess I will have to forget about doing stuff like 
fun! s:Foo()
return foo
endf
fun! s:Bar()
 85 is the current scriptname
return bar\c-R=\SNR85_Foo()\crbar
 return iconv(bar\c-R=\SNR85_Foo()\crbar,
 \ 'latin1', encoding)
endf
inoremap bfb c-r=sidBar()cr



-- 
Luc Hermitte
http://hermitte.free.fr/vim/


Re: SNR, maparg(), and UTF-8

2006-05-17 Thread Mikolaj Machowski
Dnia wtorek, 16 maja 2006 23:35, Luc Hermitte napisał:
 The problem has existed for a long time. The iconv() workaround works
 correctly with vim 7.0.012 on linux, but not with vim 7.0.000 (default
 win32 build) on windows.

Do you have +iconv or +iconv/dyn in :version? For better work with
various encodings you need iconv.dll in some readable place.

m.




Re: SNR, maparg(), and UTF-8

2006-05-17 Thread hermitte
Yakov Lerner [EMAIL PROTECTED] wrote:

 On 5/17/06, Luc Hermitte [EMAIL PROTECTED] wrote:
  I have a problem with an old hack that works fine in latin1, but starts
  to cause problems in UTF-8.
  [...]
  What is quite odd is that I have a workaround on Linux (by calling
  iconv()) which has no, useful, effect on Windows (win32 build).
 
  The problem has existed for a long time. The iconv() workaround works
  correctly with vim 7.0.012 on linux, but not with vim 7.0.000 (default
  win32 build) on windows.

 Maybe it has to do with vaule of scriptencoding ?

It was set to latin1 (I did not copy-paste the corresponding line in the example
I've provided), and it had no effect on Windows.

--
Luc Hermitte


Re: SNR, maparg(), and UTF-8

2006-05-17 Thread hermitte
Mikolaj Machowski [EMAIL PROTECTED] wrote:

 Dnia wtorek, 16 maja 2006 23:35, Luc Hermitte napisa³:
  The problem has existed for a long time. The iconv() workaround works
  correctly with vim 7.0.012 on linux, but not with vim 7.0.000 (default
  win32 build) on windows.

 Do you have +iconv or +iconv/dyn in :version? For better work with
 various encodings you need iconv.dll in some readable place.

On windows build, I have +iconv/dyn IIRC. As it is the standard build from
sourceforge, I guess the DLL is correctly provided -- I'll check that tomorrow.
Can the function iconv() continue to transform characters without the DLL ?

--
Luc Hermitte


Re: SNR, maparg(), and UTF-8

2006-05-17 Thread Mikolaj Machowski
Dnia środa, 17 maja 2006 18:34, [EMAIL PROTECTED] napisał:
 Mikolaj Machowski [EMAIL PROTECTED] wrote:
  Dnia wtorek, 16 maja 2006 23:35, Luc Hermitte napisa?:
   The problem has existed for a long time. The iconv() workaround
   works correctly with vim 7.0.012 on linux, but not with vim 7.0.000
   (default win32 build) on windows.
 
  Do you have +iconv or +iconv/dyn in :version? For better work with
  various encodings you need iconv.dll in some readable place.

 On windows build, I have +iconv/dyn IIRC. As it is the standard build
 from sourceforge, I guess the DLL is correctly provided -- I'll check

Not necessarily. AFAIR (I am not using actively Windows builds) for
proper working of converting functions you need to download iconv.dll
separately. Some encodings conversions are working without iconv.dll
some not.

m.



SNR, maparg(), and UTF-8

2006-05-16 Thread Luc Hermitte
Hello,

I have a problem with an old hack that works fine in latin1, but starts
to cause problems in UTF-8.

The hack helps to replace activation key-sequences from i-mappings with
their mapped value, which are actually calls to script-local functions.

What is quite odd is that I have a workaround on Linux (by calling
iconv()) which has no, useful, effect on Windows (win32 build).

The problem has existed for a long time. The iconv() workaround works
correctly with vim 7.0.012 on linux, but not with vim 7.0.000 (default
win32 build) on windows.

Is there a solution to my problem (may be a patch for vim) ? Or have I
to change the scope of my i-mapped local-functions to global ?

Thank in advance for any hint.

Here follows a simplified viml code that illustrates what I'm trying to
achieve.

--- % 
 script1
function! s:foo()
   complex computations according to context, ...
  return foo
endfunction

inoremap !foo! c-r=sidfoo()cr

 ==
 script2 in real situation
function! s:bar()
  let foo = '!foo!'
  let m = maparg(foo,'i')
  if strlen(m) != 0
exe 'let m=' . 
   \ substitute(m, '\(.\{-1,}\)', '.\\\1.', 'g') . ''
if has('iconv')
   uncomment the following line to activate the workaround on linux
   let m = iconv(m, 'latin1', encoding)
endif
  endif
  return 'bar'.m.'bar'
endfunction

inoremap bfb c-r=sidbar()cr
--- % 


-- 
Luc Hermitte
http://hermitte.free.fr/vim/