Bug 143818

Summary: Talk doesn't handle input in UTF-8
Product: [Fedora] Fedora Reporter: Miloslav Trmač <mitr>
Component: talkAssignee: Jindrich Novy <jnovy>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-01-10 14:57:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Internationalize talk
none
Internationalize talk
none
The necessary spec changes, together with some cleanups.
none
The modified patch none

Description Miloslav Trmač 2004-12-28 22:42:36 UTC
Description of problem:
Entering non-ASCII data creates various display problems.

Version-Release number of selected component (if applicable):
talk-0.17-23

Comment 1 Miloslav Trmač 2004-12-28 22:43:14 UTC
On second thought, it doesn't handle even iso-8859-2.

Comment 2 Miloslav Trmač 2005-01-03 20:07:56 UTC
Please disregard comment #1. It was Christmas and I was
really paying attention to the talk going on rather than
talk behavior... ISO 8859-2 seems to work now.

Comment 3 Miloslav Trmač 2005-01-08 19:18:46 UTC
Created attachment 109517 [details]
Internationalize talk

Comment 4 Miloslav Trmač 2005-01-08 19:21:43 UTC
Created attachment 109518 [details]
Internationalize talk

The attached patch (just sent upstream) adds handling of multi-byte character
encodings (most importantly UTF-8) and double-width characters (for east-Asian
languages) to the talk client.

This involves:
- Separating s_columnpos (colun number) and s_typebufpos (strlen (s_typebuf))
- Adding code to find the last (possibly incomplete due to the byte-at-a-time
  input) character in s_typebuf, just before the terminating \0
- Decoding the multibyte character in display_addch () [if possible, e.g.
  it is not incomplete], getting its width, and using it for deciding whether
  to wrap the line
- Moving all bytes of an incomplete multibyte character to the next line when
  wrapping it to the next line
- Adding dorefresh () calls before every display_addch () because it needs
  the correct s_columnpos
- Using locale-specific data to determine which characters should be ^-escaped.

Comment 5 Miloslav Trmač 2005-01-08 19:23:27 UTC
Created attachment 109519 [details]
The necessary spec changes, together with some cleanups.

Comment 6 Jindrich Novy 2005-01-10 08:22:16 UTC
Hi, thanks for the patch. Any idea why we need position independent
code for talk on s390, s390x?

Comment 7 Miloslav Trmač 2005-01-10 09:08:23 UTC
We need it always (for PIE); it's just that -fpic puts
a limit on data size on some architectures and you have
to use -fPIC for those; apparently it is s390* here.
(I haven't tested whether -fPIC is really needed, I just
assume this was the reason.)

Comment 8 Jindrich Novy 2005-01-10 09:34:11 UTC
I modified these things:

- Removed redundant #define _GNU_SOURCE from the beginning of display.c
  since we use -D_GNU_SOURCE in CFLAGS. (added in spec)

- Removed redundant variable 'y' introduced by your patch. There's no 
  need to use getyx() as we have getcurx() when we're only interested in
  the x position.


Comment 9 Jindrich Novy 2005-01-10 09:35:01 UTC
Created attachment 109547 [details]
The modified patch