palaniyappanBala / klish

Automatically exported from code.google.com/p/klish
Other
0 stars 0 forks source link

Error when command input Chinese characters #140

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.klish support utf8, my xml command and command help have chinese 
characters,klish can display correct, but when i input command who have chinese 
characters, There are several problems
a)display is not correct
b)backspace key delete is not correct
c)when enter ctrl+c to input new command , command buffer is not clear 
d)klish may crashd for double free() or segment fault
What is the expected output? What do you see instead?
# ?J?-ËÄJ *** glibc detected *** /usr/local/klish/bin/clish: double free or 
corruption (fasttop): 0x000000000094c260 ***

What version of the product are you using? On what operating system?
klish-1.6.7 , operatiing system: centos 6.x 64bit , characters: utf8

Please provide any additional information below.

Original issue reported on code.google.com by yelia...@gmail.com on 28 Dec 2013 at 12:48

GoogleCodeExporter commented 8 years ago
Probably I have implemened a two-byte UTF-8 encodings. How much bytes use each 
Chinese character?

Original comment by serj.kalichev@gmail.com on 28 Dec 2013 at 11:33

GoogleCodeExporter commented 8 years ago
The Chinese character use three bytes by utf-8, thanks. 

Original comment by yelia...@gmail.com on 28 Dec 2013 at 12:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I read the source code, no problem, the highest two bits of  utf-8 first byte 
are all 1(first byte may is 0xc0, 0xe0, 0xf0), but the display is a problem, 
but program may crash for segment fault. I can only modify the source code to 
prohibit input Chinese characters, it is good to me, because All commands are 
English letters, I just to prevent the input Chinese, program error.

Original comment by yelia...@gmail.com on 28 Dec 2013 at 6:46

GoogleCodeExporter commented 8 years ago
Hi

I have made some changes to sourcecode to fix the problem.

Please try it on your 3-byte utf8 locale. I have tested it using 2-byte locale 
only.
If it's still broken send me your locale settings to reproduce problem.

Try git revision 21653aac8728 or 1.6 git branch. You can find git repository at 
https://src.libcode.org/klish

Thanks.

Original comment by serj.kalichev@gmail.com on 29 Dec 2013 at 5:04

GoogleCodeExporter commented 8 years ago
Sorry, i download  revision 21653aac872, but the problem is not solved. I use 
virtual box vm install centos 6.4 64 bit system. The var LANG=zh_CN.UTF-8. I 
use vm or secureCRT(ssh) may correctly input and display chinese characters, 
but klish is not.
problem:
1) display is not correct eg. # ?J??
2) Move the cursor is not corect, by letter not by chinese characters .  eg. # 
?J?-四J??
3) delete the command , Either delete incomplete, or deletes prompt. 
4)one chinesec characters display four byte. 
eg. #中 -> # ?J?- .

    ctrl+u double free()  now is correct.

Original comment by yelia...@gmail.com on 6 Jan 2014 at 1:56

GoogleCodeExporter commented 8 years ago
What the right way to install chinese? May be some manual page...
I can create terminal with zh_CN locale and can see chinese characters but 
can't enter them.

In gnome-control panel I add chinese for switching input method but it allow to 
enter english characters but not chinese. it's strange for me.

Original comment by serj.kalichev@gmail.com on 14 Jan 2014 at 7:38

GoogleCodeExporter commented 8 years ago
Accepted. I can reproduce it.
Oh....
Chinese chars use two char positions for one symbol

Original comment by serj.kalichev@gmail.com on 6 Feb 2014 at 1:31

GoogleCodeExporter commented 8 years ago
Hi
Probably i have fixed the issue.
Please test it.
Use revision 8c88b3094510 from git repository.
I'm waiting for test results.
Thanks.

Original comment by serj.kalichev@gmail.com on 25 Feb 2014 at 1:57

GoogleCodeExporter commented 8 years ago

Original comment by serj.kalichev@gmail.com on 1 Mar 2014 at 8:19