On Tue, 2010-01-26 at 13:27 -0500, Joey Hess wrote:
> Ben Hutchings wrote:
> > The dialog and whiptail programs support the escape sequence '\n'
> > which is converted to a new-line.  However they do not provide any way
> > of printing this character sequence literally.
> 
> What a wonderful er, feature for dialog to have. :-P
> 
> > Inserting the zero-width joiner U+2060 between the two characters
> > seems to be a valid workaround.  However, I was unable to implement
> > this fix in Dialog.pm as that character is lost somewhere on the way
> > to execve().  I don't understand Perl's handling of character
> > encodings well enough to solve this myself.
> 
> Can you send the patch you tried?

--- a/Debconf/FrontEnd/Dialog.pm
+++ b/Debconf/FrontEnd/Dialog.pm
@@ -163,7 +163,13 @@
        my $lines = $this->screenheight;
        my ($text, $height, $width)=$this->sizetext($intext);
 
-       my @lines = split(/\n/, $text);
+       sub hide_escape {
+           my $line = $_;
+           $line =~ s/\\n/\\\xe2\x81\xa0n/g;
+           return $line;
+       }
+
+       my @lines = map(&hide_escape, split(/\n/, $text));
        my $num;
        my @args=('--msgbox', join("\n", @lines));
        if ($lines - 4 - $this->borderheight <= $#lines) {
--- END ---

I also tried writing the ZWJ character as \x{2060}.

Ben.

-- 
Ben Hutchings
Any smoothly functioning technology is indistinguishable from a rigged demo.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to