bugGNU roff - Bugs: bug #55042, troffrc: doesn't .tr \[u00A0] to...

 
 

bug #55042: troffrc: doesn't .tr \[u00A0] to \~ as it does \[char160]

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Sat 17 Nov 2018 04:07:21 PM UTC
   
 
Category:  Macro - others/general Severity:  2 - Minor
Item Group:  Incorrect behaviour Status:  Invalid
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 10 Jun 2022 10:14:58 PM UTC, comment #2: 

See #58930 for related issues.

G. Branden Robinson <gbranden>
Group administrator
Thu 17 Jun 2021 10:07:12 AM UTC, comment #1: 

I don't believe this report is correct.

preconv in groff 1.22.4 appears to map the no-break space correctly.  In a UTF-8 environment, however, it is important to remember that this character does not have a single-byte representation.


$ printf '\302\240\n' | preconv
.lf 1 -
\[u00A0]
$ printf '\240\n' | preconv -e latin-1
.lf 1 -
\[u00A0]


Notice what happens if we try to feed a Latin-1-encoded no-break space to preconv without giving the program a hint about the input encoding:


$ printf '\240\n' | preconv
.lf 1 -
\[uFFFD]


We get the Unicode replacement character, as documented in the man page.

I could not make sense of the example input.  Every character in the following is US-ASCII and preconv therefore performs no transformations.  Further, the purpose of the commented line is not clear to me.


.pl 3v
A\[char161]B\[char160]C
.br
.\".tr \[u00A0]\~
A\[u00A1]B\[u00A0]C


Closing, as preconv appears to be working as documented.

Feel free to reopen if a minimal reproducing case of erroneous behavior can be established.  Please use printf(1) or similar so that it is precisely clear what the input stream consists of; I don't trust Savannah's web interface to not mangle whitespace characters, especially exotic ones outside of US-ASCII.

G. Branden Robinson <gbranden>
Group administrator
Sat 17 Nov 2018 04:07:21 PM UTC, original submission:  

From f47b7dd139525bf3b8b4fbe767c3a45816c8445a Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Sat, 17 Nov 2018 15:59:09 +0000
Subject: [PATCH] The character \[u00A0] is not recognized
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

  The input character "no-break space" (' ', 0xA0) is mapped by "groff"
to '\~' (groff_char(7)), but only the character name '\[char160]' is
translated in the file "tmac/troffrc".

  The "preconv" translates the no-break space to the name '\[u00A0]'.

  Example:

.pl 3v
A\[char161]B\[char160]C
.br
.\".tr \[u00A0]\~
A\[u00A1]B\[u00A0]C

  or

echo ' ' | preconv

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 tmac/troffrc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


diff --git a/tmac/troffrc b/tmac/troffrc
index 1bd4aa8c..8895a9a0 100644
--- a/tmac/troffrc
+++ b/tmac/troffrc
@@ -33,10 +33,14 @@ troffrc!X100 troffrc!X100-12 troffrc!lj4 troff!lbp troffrc!html troffrc!pdf
 .
 .\" Test whether we work under EBCDIC and map the no-breakable space
 .\" character accordingly.
-.do ie '\[char97]'a' \
+.do ie '\[char97]'a' \{\
 .        do tr \[char160]\~
-.el \
+.        do tr \[u00A0]\~
+.\}
+.el \{\
 .        do tr \[char65]\~
+.        do tr \[u0041]\~
+.\}
 .
 .\" Set the hyphenation language to 'us'.
 .do hla us
--
2.19.1


Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by bgarrigues (Updated the item)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-06-10 gbranden Summary[PATCH] troffrc: doesn't .tr \[u00A0] to \~ as it does \[char160] troffrc: doesn't .tr \[u00A0] to \~ as it does \[char160]
    2021-06-17 gbranden StatusNone Invalid
        Assigned toNone gbranden
        Open/ClosedOpen Closed
    2020-07-25 gbranden Summary[PATCH] The character \[u00A0] is not recognized [PATCH] troffrc: doesn't .tr \[u00A0] to \~ as it does \[char160]
    2018-11-25 bgarrigues Severity3 - Normal 2 - Minor

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code