# vim, utf-8 and urxvt



## athos (Apr 12, 2012)

Hello everyone, could somebody clarify me wich is the actual support for UTF-8? I mean, on console, using LC_CTYPE=es_ES.UTF-8 I have the following "typos":









Notice the "--" at ls(1), and the "â–¸" at the NERDTree plugin in vim. As a side note, when using es_ES.ISO8859-15, ls(1) is displayed correctly (not in vim)
As another side note, the vim encoding is UTF-8, and the terminal is x11/rxvt-unicode.

Why is my system doing this? How can I get it to work?

Thanks.


----------



## graudeejs (Apr 12, 2012)

*S*et it also in .xinitrc.


----------



## athos (Apr 12, 2012)

Hello graudeejs,

How? I mean, X(7), says that LC_* variables are environmental, at first I tought that, since in my computer launches Xorg as root, changing root's .csh file would set it up nicely, so I changed it, and there has been no more changes.

After that I tought that maybe X was run as another user, so I set up my ~/.xsession and added the LC_* lines, I rebooted and it also didn't work.

Could you please give me some pointers about this?


----------



## graudeejs (Apr 12, 2012)

To be sure it works for me, I set LOCALE in ~/.xinitrc (.xsession is symlink to ~/.xinitrc) and in ~/.profile

*Y*ou can check my dotfiles: https://github.com/graudeejs/dot.files

Would be nice, if I could check yout configs, that would be much faster than blindly guessing what isn't working.

BTW, what shell do you use, what WM, and not tell me your using root to log in in X.


----------



## athos (Apr 12, 2012)

graudeejs, since I wanted to use a github repo for a long time, I had just made one, the link is https://github.com/4thos/dotfiles. Let me know if you find anything suspicious.

My current set (and my only one since I'm using FreeBSD) is:

WM:       x11-wm/spectrwm
Shell:    shells/zsh
DM:       x11/xdm
BTW, I've been looking at your .xinitrc in your repo and I couln't find any locale setting  
Where is it? Is your .xinitrc updated?


----------



## graudeejs (Apr 12, 2012)

At the very top of my .xinitrc I have

```
[ -f "$HOME/.profile" ] && . "$HOME/.profile"
```

This means read (source) .profile :d
Since .xinitrc, .profile and .shrc are all shell scripts, it's all perfectly valid.

BTW, you didn't give link.

EDIT:
Ok, it just showed up.


----------



## graudeejs (Apr 12, 2012)

*I*n you*r* .zshrc, you have

```
export LANG=en_US.ISO8859-15
export LC_CTYPE=es_ES.ISO8859-15
export LC_COLLATE=es_ES.ISO8859-15
export LC_TIME=es_ES.ISO8859-15
export LC_NUMERIC=es_ES.ISO8859-15
export LC_MONETARY=es_ES.ISO8859-15
export LC_MESSAGES=en_US.ISO8859-15
export MM_CHARSET=es_ES.ISO8859-15
```
*T*hat's not unicode.

*A*lso you don't set locale in your .xinitrc. I had weird behaviour until I started setting locale in both shell startup script and .xinitrc.


----------



## athos (Apr 12, 2012)

graudeejs said:
			
		

> ```
> [ -f "$HOME/.profile" ] && . "$HOME/.profile"
> ```



That makes sense, I currenly use es_ES.ISO8859-15 to be able to use accents and characters like Ã±.

Ok, I'm going to give it a try now.

Thanks.


----------



## graudeejs (Apr 12, 2012)

athos said:
			
		

> That makes sense, I currenly use es_ES.ISO8859-15 to be able to use accents and characters like Ã±.
> 
> Ok, I'm going to give it a try now.
> 
> Thanks



Once you switch to unicode you will need to switch language, to be able to type those characters.

I have a handy script for this https://github.com/graudeejs/wmscripts/blob/master/swLang.sh to be integrated in WM.

Toy can switch to other lang with `$ setxkbmap`


----------



## athos (Apr 12, 2012)

Ok, I set it all up, and now things are starting to work, thanks!

There's still a little problem:





Do you guys know why I can't see this correctly?
I'm going to push the git repo (already done)
Remember: https://github.com/4thos/dotfiles


----------



## graudeejs (Apr 12, 2012)

athos said:
			
		

> Ok, I set it all up, and now things are starting to work, thanks!
> 
> There's still a little problem:
> 
> ...



Setp 1) verify that you use unicode in shell and X apps
Step 2) verify that vim is configure to use unicode

EDIT, *I* wouldn't be too surprised if those artifacts are because of how you set *t_Co* in vim

*Y*ou m*a*y try my vim configuration https://github.com/graudeejs/dot.vim/blob/master/vimrc as it's 100% working with UTF-8

BTW, that was in console or GUI? (Sounds weird, but vim can be configured so that you can't tell the difference).

Time for me to sleep, see you.


----------



## athos (Apr 13, 2012)

graudeejs said:
			
		

> Setp 1) verify that you use unicode in shell and X apps
> Step 2) verify that vim is configure to use unicode
> 
> BTW, that was in console or GUI?



Well, it seems I am actualling using UTF-8 at both shell and X applications (I can write this at both Ã¦â€Â¢Ã°â‚¬Ä‘Å‹Ä§â†’jÄ¸Å‚ÂµnÃ¸Ã¾@Â¶ÃŸÅ§â†“â€œÅ‚Â»â†Â«).

I tried your vim configuration, and it didn't work (and mine using encoding=utf-8[/fle] neither worked)

This is quite weird, the character used at gvim "â–¸" can't get displayed at terminal. Perhaps it has to do with x11/rxvt-unicode .Xresources, I'm going to take a look at the manual.

(That last scrot was actually vim at terminal)

EDIT: The manual says nothing about this.

EDIT2: Those artifacts are also displayed when I read a manual page, and the word is trun-
cated like this ($PAGER == less)


----------



## graudeejs (Apr 13, 2012)

You haven't set unicode font for urxvt
-*-terminus-*-*-*-*-12-*-*-*-*-*-iso8859-15 << this is what you have

add this 

```
URxvt.font: xft:DejaVu Sans Mono:pixelsize=12
URxvt.boldFont: xft:DejaVu Sans Mono:bold:pixelsize=12
```
to your ~/.Xresources

For more info check:
https://github.com/graudeejs/dot.files/blob/master/dot.Xdefaults
or
https://github.com/graudeejs/dot.files/blob/master/Xdefaults.sh


----------



## athos (Apr 13, 2012)

Well, it finally works...

Do you know of any font viewer like xfontsel to use with Xft fonts?

Many thanks graudeejs!

Here's the proof! (it's vim)


----------



## graudeejs (Apr 13, 2012)

athos said:
			
		

> Do you know of any font viewer like xfontsel to use with Xft fonts?



Can't help with that.


----------



## athos (Apr 13, 2012)

Anyways, many thanks!


----------

