On Sun, Dec 23, 2007 at 05:14:40PM +1800, Bo Peng wrote:

> > Yes. I am trying to display the character ... There is something
> > tricky about the handling of a character in docstring.
> 
> OK. With the attached simple patch, the offending characters are
> replaced by <Uncodable character: '?'>. The whole paragraph is
> displayed (as Enrico wishes), but it is easy to see where the
> offending characters are. The text seems to be long and I will accept
> any suggestion such as <?>, <Error: ?> where ? is the offending
> character.

Maybe the offending character could be simply shown in red, for example.

> With all my tests, I can not see any uncodable char in the view source
> and error dialog. This is not a problem with my patch because they are
> displayed as blanks in the view source dialog before. There are
> obviously two solutions:
> 
> 1. Because the main window can display these characters, there might
> be some qt trick to make view source and error dialog display them as
> well.
> 
> 2. Do not try to display them at all. For example, display ??? in the
> places of offending characters.
> 
> Maybe Abdel knows why they are displayed as blanks?

This is a known problem. Due to the fact that our wide char is not a
real type but a typedef, one should use os.put(c) rather than os << c.
I attach here your patch revised such that to comply to the above.

-- 
Enrico
Index: src/Paragraph.cpp
===================================================================
--- src/Paragraph.cpp   (revision 22278)
+++ src/Paragraph.cpp   (working copy)
@@ -2236,10 +2236,16 @@ bool Paragraph::simpleTeXOnePar(Buffer c
                                        basefont, outerfont, open_font,
                                        runningChange, *style, i, column, c);
                } catch (EncodingException & e) {
-                       // add location information and throw again.
-                       e.par_id = id();
-                       e.pos = i;
-                       throw(e);
+                       if (runparams.dryrun) {
+                               os << "<Uncodable character: '";
+                               os.put(c);
+                               os << "'>";
+                       } else {
+                               // add location information and throw again.
+                               e.par_id = id();
+                               e.pos = i;
+                               throw(e);
+                       }
                }
 
                // Set the encoding to that returned from simpleTeXSpecialChars 
(see

Reply via email to