cc: devel (original report: 
http://lists.gnu.org/archive/html/screen-users/2010-02/msg00036.html)

* Xavier Guérin had this to say on [18 Feb 2010, 18:00:46 +0100]:
> Here are two screenshots:
> 
> 1 - Normalized UTF-8, screen version 4.0.3 on SL (10.6.2) using macports 
> (good_behaviour) :
> 
> 
> 
> 1 - Normalized UTF-8, screen version 4.1.0 on SL (10.6.2) using the git repo 
> (bad_behaviour) :
> 
> 
> 
> The situation is as follows: my ZSH's chpwd updates the current window title 
> with the current PWD. The issue is that apple uses UTF-8 norm D to store its 
> file names (Normalized Form Decombined, NFD). The solution I found with 
> screen 4.0.3 was to renormalize PWD into a combined form.
> 
> What exactly happens with 4.1.0 is as follows: as soon as I change PWD to a 
> directory which name contains and UTF-8 character (normalized), the 
> hardstatus disappears, screen resets the buffer,  and some '\n' are printed 
> out. From this moment, screen keeps behaving weirdly until I change PWD.

Thank you very much. This is quite useful.

I could reproduce the problem with a 'Thèse' directory of my own. For
this particular case, the attached patch works for me. But it is likely
that the patch is not completely correct, and may break auto-hardstatus
for windows for some. I am weak on encoding issues, and I need to
test more to fine-tune the fix. In the meantime, if you could try it out
and let me know if this works you too, then that'd be great.

Also, help/suggestions about the encoding issue from anyone would also be
very welcome!

Cheers,
Sadrul

diff --git a/src/ansi.c b/src/ansi.c
index d15867b..83bf608 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -1573,7 +1573,21 @@ StringEnd()
          curr->w_hstatus = 0;
        }
       if (curr->w_string != curr->w_stringp)
-       curr->w_hstatus = SaveStr(curr->w_string);
+       {
+#ifdef UTF8
+         if (curr->w_encoding == UTF8)
+           {
+             int len = RecodeBuf(curr->w_string, curr->w_stringp - 
curr->w_string,
+                 0, curr->w_encoding, 0);
+             curr->w_hstatus = malloc(len + 1);
+             RecodeBuf(curr->w_string, curr->w_stringp - curr->w_string, 0, 
curr->w_encoding,
+                 curr->w_hstatus);
+             curr->w_hstatus[len] = 0;
+           }
+         else
+#endif
+         curr->w_hstatus = SaveStr(curr->w_string);
+       }
       WindowChanged(curr, 'h');
       break;
     case PM:

Reply via email to