Thanks James,

I'll use "\u0440" as you suggested

D


________________________________
De : James Vega <james...@jamessan.com>
À : vim_dev@googlegroups.com
Envoyé le : Mer 9 février 2011, 19h 10min 55s
Objet : Re: tr() problem ?

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.

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