I just tested:

:com! Test ec '♛'
then
:Test prints ♀<fd>Q
:ec '♛' prints '♛'

So the problem is :com related not tr() as previously thought




________________________________
De : James Vega <james...@jamessan.com>
À : vim_dev@googlegroups.com
Cc : Bram Moolenaar <b...@moolenaar.net>
Envoyé le : Jeu 10 février 2011, 21h 04min 42s
Objet : Re: tr() problem ?

On Wed, Feb 9, 2011 at 2:10 PM, James Vega <james...@jamessan.com> wrote:
> On Wed, Feb 9, 2011 at 12:04 PM, Dimitar DIMITROV <mitk...@yahoo.fr> wrote:
>> But this doesn't:
>>
>> command! Translate call setline(line('.'), tr(getline('.'),
>>    \'ABVGDEWZIJKLMNOPRSTUYFHXC$^&}{!|Qabvgdewzijklmnoprstuyfhxc467][1\q',
>>    \'АБВГДЕЖЗИЙКЛМНОПРСТУYФХXЦЧШЩЪЬЮЮЯабвгдежзийклмнопрстуyфхxцчшщъьююя'))
>>
>> then :Translate on any line
>>
>> The error is:
>> E475: Invalid argument:
>> ABVGDEWZIJKLMNOPRSTUYFHXC$^&}{!|Qabvgdewzijklmnoprstuyfhxc467][1\q
>
> This has something to do with how Vim is storing the U+0440 character
> (which breaks down to \xd1\x80) in the "to" string.  A minimal
> reproduction can be done with this simplified version:
>
>  command! Translate echo tr(getline('.'), 'r', 'р')
>
> and then use Translate with your cursor on the line defining the
> command.
>
> In fact, if you use the following erroneous version of the command, the
> error string that Vim prints when you try to use :Translate will show
> that the U+0440 character has been corrupted:
>
>  command! Translate echo tr(getline('.'), 'r', \'p')
>
> I end up getting: E15: Invalid expression: \'р<fe>X')
>
> Everything works fine if the command is defined using "\u0440" instead
> of the literal character.

Another interesting data point is that the workaround of using "\u0440"
only works when building Vim without GUI support.  Building with GUI
type of any support (I tried Athena, motif and Gtk2) causes the problem
to occur even when using "\u0440" instead of "р".

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <james...@jamessan.com>

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

Raspunde prin e-mail lui