[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim-dev
Subject:    UTF8 characters in an array treated poorly...
From:       Ron Aaron <ron () ronware ! gotdns ! com>
Date:       2003-09-22 22:06:08
[Download RAW message or body]

Try this function:

fun! RevChars()
	let line=getline('.')
	let newline=''
	let hi=strlen(line)-1
	while hi >= 0
		let newline = newline . line[hi]
		let hi=hi=1
	endwhile
	call setline('.', newline)
endfun

Now try it on the line:
	abcdefg

you will get as expected:
	gfedcba


Now try it on the line containing the utf8 characters (hex Unicode
values given for transport reasons):
	05ea 05e8 05d2 05d9 05d0

you will get:
	0090 05d9 05d2 05e8 0fea 00d7


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic