comparison src/xselect.c @ 17721:4ebed8fa4fcb

(selection_data_to_lisp_data): If TYPE is `STRING' and DATA contains 8-bit codes, decode them as Latin-1 characters. (lisp_data_to_selection_data): Supply 4th arg TABLE as Qnil to find_charset_in_str.
author Kenichi Handa <handa@m17n.org>
date Sat, 10 May 1997 03:37:01 +0000
parents 549a40f0cbe1
children 2232640df372
comparison
equal deleted inserted replaced
17720:530ee47cb56b 17721:4ebed8fa4fcb
1461 1461
1462 /* Convert any 8-bit data to a string, for compactness. */ 1462 /* Convert any 8-bit data to a string, for compactness. */
1463 else if (format == 8) 1463 else if (format == 8)
1464 { 1464 {
1465 Lisp_Object str; 1465 Lisp_Object str;
1466 1466 int require_encoding = 0;
1467 if (type != dpyinfo->Xatom_TEXT && type != dpyinfo->Xatom_COMPOUND_TEXT) 1467
1468 /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode DATA
1469 to Emacs internal format because DATA may be encoded in
1470 compound text format. In addtion, if TYPE is `STRING' and
1471 DATA contains any 8-bit Latin-1 code, we should also decode
1472 it. */
1473 if (type == dpyinfo->Xatom_TEXT || type == dpyinfo->Xatom_COMPOUND_TEXT)
1474 require_encoding = 1;
1475 else if (type == XA_STRING)
1476 {
1477 int i;
1478 for (i = 0; i < size; i++)
1479 {
1480 if (data[i] >= 0x80)
1481 {
1482 require_encoding = 1;
1483 break;
1484 }
1485 }
1486 }
1487 if (!require_encoding)
1468 str = make_string ((char *) data, size); 1488 str = make_string ((char *) data, size);
1469 else 1489 else
1470 { 1490 {
1471 /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode
1472 DATA to Emacs internal format because DATA may be
1473 encoded in compound text format. */
1474 int bufsize, dummy; 1491 int bufsize, dummy;
1475 unsigned char *buf; 1492 unsigned char *buf;
1476 struct coding_system coding; 1493 struct coding_system coding;
1477 Lisp_Object sym = intern ("iso-8859-1"); 1494 Lisp_Object sym = intern ("iso-8859-1");
1478 1495
1586 *size_ret = XSTRING (obj)->size; 1603 *size_ret = XSTRING (obj)->size;
1587 *data_ret = XSTRING (obj)->data; 1604 *data_ret = XSTRING (obj)->data;
1588 bzero (charsets, MAX_CHARSET + 1); 1605 bzero (charsets, MAX_CHARSET + 1);
1589 num = ((*size_ret <= 1) /* Check the possibility of short cut. */ 1606 num = ((*size_ret <= 1) /* Check the possibility of short cut. */
1590 ? 0 1607 ? 0
1591 : find_charset_in_str (*data_ret, *size_ret, charsets)); 1608 : find_charset_in_str (*data_ret, *size_ret, charsets, Qnil));
1592 1609
1593 if (!num || (num == 1 && charsets[CHARSET_ASCII])) 1610 if (!num || (num == 1 && charsets[CHARSET_ASCII]))
1594 { 1611 {
1595 /* No multibyte character in OBJ. We need not encode it. */ 1612 /* No multibyte character in OBJ. We need not encode it. */
1596 *nofree_ret = 1; 1613 *nofree_ret = 1;