Re: expand("%") and utf-8 characters in directory names

2015-06-24 Fir de Conversatie Charles Campbell
Christian Brabandt wrote:
>  Am 2015-04-20 18:28, schrieb Charles Campbell:
>> I've attached a small tarball illustrating the problem I'm having with
>> expand().
>>
>> gunzip jose.tar.gz
>> tar xf jose.tar
>> cd josé
>> vi junk.vim
>> :so %
>> :echo x[4]
>> :echo y[4]
>>
>> With the first echo, you'll see (using utf-8 for encoding)  .  This
>> is the hex code for a é.  The second echo shows .
>>
>> :echo x
>>
>> shows /jos/junk.vim
>>
>> :echo y
>>
>> shows /josé/junk.vim
>>
>> This problem has some definitely unwanted effects.  At least one person
>> redid their home directory's name to avoid the accent, because netrw
>> won't display it correctly (or use it correctly) because of this bug.
>
> That is an encoding issue. The 'é' in your tar archive is latin1 encoded
> while your Vim tries to read it as utf-8. BTW: How does the shell
> display it? Somehow the shell should know the encoding, so you might
> check the output of the locale command and try to use iconv() like this:
> iconv(expand("%:p"), 'latin1', 'utf-8')
>
> BTW: There is a patch in the todo list, that should fix that issue.
> Search for 'systemencoding'
Hello, Christian:

Sorry for taking awhile to reply to this.  Looks like you're quite right
-- it was an encoding issue.   When I make a "josé" directory using
utf-8 it does show up with netrw correctly (with which I'm using utf-8).

Regards,
Chip Campbell

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: expand("%") and utf-8 characters in directory names

2015-04-20 Fir de Conversatie Christian Brabandt

 Am 2015-04-20 18:28, schrieb Charles Campbell:

I've attached a small tarball illustrating the problem I'm having with
expand().

gunzip jose.tar.gz
tar xf jose.tar
cd josé
vi junk.vim
:so %
:echo x[4]
:echo y[4]

With the first echo, you'll see (using utf-8 for encoding)  .  This
is the hex code for a é.  The second echo shows .

:echo x

shows /jos/junk.vim

:echo y

shows /josé/junk.vim

This problem has some definitely unwanted effects.  At least one person
redid their home directory's name to avoid the accent, because netrw
won't display it correctly (or use it correctly) because of this bug.


That is an encoding issue. The 'é' in your tar archive is latin1 encoded
while your Vim tries to read it as utf-8. BTW: How does the shell
display it? Somehow the shell should know the encoding, so you might
check the output of the locale command and try to use iconv() like this:
iconv(expand("%:p"), 'latin1', 'utf-8')

BTW: There is a patch in the todo list, that should fix that issue.
Search for 'systemencoding'

Best,
Christian

--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: expand("%") and utf-8 characters in directory names

2015-04-20 Fir de Conversatie Charles Campbell
Charles Campbell wrote:
> Christian Brabandt wrote:
>> Hi Charles!
>>
>> On Fr, 27 Mär 2015, Charles Campbell wrote:
>>
>>> Bram Moolenaar wrote:
 Charles Campbell wrote:

> I tried a directory named "josé" and found that netrw wasn't handling it
> well.  One of the reasons is expand("%"), which is used to get the full
> path.  However, when in that directory, expand("%") shows
> /home/cec/joe instead of the desired /home/cec/josé .  Do I need to
> program around this or is this problem a bug with expand()?
 I don't see this problem.  What is 'encoding' set to?

>>> enc is utf-8.  By bisection of my .vimrc, I find that the following is
>>> enough in a .vimrc to cause the  to appear instead of é
>>>
>>>
>>> set nocp
>>> filetype plugin on
>>> set enc=utf-8
>> In what filetype did you execute the expand() call?
>>
> The filetype: netrw
>
> Try having a directory called josé with a file therein called "one".
>
> vim -u (whatever you called the vimrc above)
> :echo expand("%:p")
>
> You'll see something like /home/cec/jos/one
>
> With this, there's no filetype involved.
>
Hello!

I've attached a small tarball illustrating the problem I'm having with
expand().

gunzip jose.tar.gz
tar xf jose.tar
cd josé
vi junk.vim
:so %
:echo x[4]
:echo y[4]

With the first echo, you'll see (using utf-8 for encoding)  .  This
is the hex code for a é.  The second echo shows . 

:echo x

shows /jos/junk.vim

:echo y

shows /josé/junk.vim

This problem has some definitely unwanted effects.  At least one person
redid their home directory's name to avoid the accent, because netrw
won't display it correctly (or use it correctly) because of this bug.

Regards,
Chip Campbell

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


jose.tar.gz
Description: GNU Zip compressed data


Re: expand("%") and utf-8 characters in directory names

2015-03-27 Fir de Conversatie Charles Campbell
Christian Brabandt wrote:
> Hi Charles!
>
> On Fr, 27 Mär 2015, Charles Campbell wrote:
>
>> Bram Moolenaar wrote:
>>> Charles Campbell wrote:
>>>
 I tried a directory named "josé" and found that netrw wasn't handling it
 well.  One of the reasons is expand("%"), which is used to get the full
 path.  However, when in that directory, expand("%") shows
 /home/cec/joe instead of the desired /home/cec/josé .  Do I need to
 program around this or is this problem a bug with expand()?
>>> I don't see this problem.  What is 'encoding' set to?
>>>
>> enc is utf-8.  By bisection of my .vimrc, I find that the following is
>> enough in a .vimrc to cause the  to appear instead of é
>>
>>
>> set nocp
>> filetype plugin on
>> set enc=utf-8
> In what filetype did you execute the expand() call?
>
The filetype: netrw

Try having a directory called josé with a file therein called "one".

vim -u (whatever you called the vimrc above)
:echo expand("%:p")

You'll see something like /home/cec/jos/one

With this, there's no filetype involved.

Regards,
Chip Campbell

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: expand("%") and utf-8 characters in directory names

2015-03-27 Fir de Conversatie Christian Brabandt
Hi Charles!

On Fr, 27 Mär 2015, Charles Campbell wrote:

> Bram Moolenaar wrote:
> > Charles Campbell wrote:
> >
> >> I tried a directory named "josé" and found that netrw wasn't handling it
> >> well.  One of the reasons is expand("%"), which is used to get the full
> >> path.  However, when in that directory, expand("%") shows
> >> /home/cec/joe instead of the desired /home/cec/josé .  Do I need to
> >> program around this or is this problem a bug with expand()?
> > I don't see this problem.  What is 'encoding' set to?
> >
> enc is utf-8.  By bisection of my .vimrc, I find that the following is
> enough in a .vimrc to cause the  to appear instead of é
> 
> 
> set nocp
> filetype plugin on
> set enc=utf-8

In what filetype did you execute the expand() call?

Best,
Christian
-- 
Ich brenne - sagte die Lampe.

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: expand("%") and utf-8 characters in directory names

2015-03-27 Fir de Conversatie Charles Campbell
Bram Moolenaar wrote:
> Charles Campbell wrote:
>
>> I tried a directory named "josé" and found that netrw wasn't handling it
>> well.  One of the reasons is expand("%"), which is used to get the full
>> path.  However, when in that directory, expand("%") shows
>> /home/cec/joe instead of the desired /home/cec/josé .  Do I need to
>> program around this or is this problem a bug with expand()?
> I don't see this problem.  What is 'encoding' set to?
>
enc is utf-8.  By bisection of my .vimrc, I find that the following is
enough in a .vimrc to cause the  to appear instead of é


set nocp
filetype plugin on
set enc=utf-8


Regards,
Chip

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: expand("%") and utf-8 characters in directory names

2015-03-26 Fir de Conversatie Bram Moolenaar

Charles Campbell wrote:

> I tried a directory named "josé" and found that netrw wasn't handling it
> well.  One of the reasons is expand("%"), which is used to get the full
> path.  However, when in that directory, expand("%") shows
> /home/cec/joe instead of the desired /home/cec/josé .  Do I need to
> program around this or is this problem a bug with expand()?

I don't see this problem.  What is 'encoding' set to?

-- 
An indication you must be a manager:
You believe you never have any problems in your life, just
"issues" and "improvement opportunities".

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.