From: swalker@BBN.COM (Susan Walker)
Newsgroups: fj.mail-lists.x-window
Subject: R5 Internationalization Questions
Date: 18 Dec 92 01:32:26 GMT
Distribution: fj
Organization: Bolt Beranek and Newman Inc., Cambridge MA

Date: 17 Dec 1992 20:28:03 GMT
Message-Id: <lj1omjINNse0@news.bbn.com>
Newsgroups: comp.windows.x,comp.windows.x.motif

I am currently modifying an existing Motif application so it will run
in Kanji on X11R5, Motif 1.2 on a HP700.  The application uses UIL to define
its widgets.  The text strings for the application are stored in separate UIL
files which are brought in at runtime depending on the setting of the
LANG environment  variable.  Until now this scheme was working just fine.  

I have now mucked with my application so it can deal with 16 bit
characters and other related issues.  There are 2 problems that I
can't seem to solve.  Can anyone out there help me out?


PROBLEM 1 - newline characters in Kanji

   Currently my application loads multi line text into a ScrolledText
   widget in this way: 

    ****UILfile1 ******
	MSG1: exported  "This is line 1 of text. \n"  &
			"This is line 2 of text. \n"  &
			"This is line 3 of text." ;
	MSGTITLE: exported compound_string("MY KANJI TEXT TITLE HERE");

    **** UILfile2 *****
	MSG1: imported string;
	MSGTITLE: imported compound_string;

	mytext : XmScrolledText
	  { 
           arguments
	     { XmNvalue = MSG1;	  
	     !  more stuff in here - you get the picture
	     };
	   };
	myform : XmForm
	  {
	   arguments
	     { XmNdialogStyle = XmDIALOG_MODELESS;
	       XmNdialogTitle = MSGTITLE;
	     };
	   controls
	     { XmScrolldeText mytext;
	     };
	  };

   Now that my text has been translated to Kanji, \n no longer works.
   It seems that the functionality of a newline character is dependent on
   the character set of the string and in Kanji \ has the same code as
   YEN.  The result is 1 long line of text which contains lots of \n.

   I've got several ideas but each one has a snag.  Please keep in
   mind that there are MANY instances like this in my application, and
   they are more likely to have 60 lines of next, not 3 like in my
   example. 	

   ->Possible Solution 1
	Put single quotes around the \n.  Didn't work.  Now the displayed
	text contains '\n' instead of just \n.

   ->Possible Solution 2
	Replace the \n with the Kanji character for new line.
	IS THERE A KANJI CHARACTER FOR NEW LINE?
        CAN SOMEONE TELL ME WHAT IT IS?	

   ->Possible Solution 3
	Replace:   Exported "line1 \n" & "line2 \n"; 
	with:  exported compound_string("line1, separate = true) &
			compound_string("line2");

	BUT THE XmNvalue OF THE XmScrolledText WIDGET WANTS A STRING,
        NOT A COMPOUND STRING!

   ->Possible Solution 4
	ANYONE OUT THERE WITH ANY IDEAS THAT ARE FEASIBLE KEEPING IN
        MIND THAT THIS IS A LARGE ALREADY RELEASED APPLICATION?????

   I have other places in my code where the type of the resource being
   assigned is string and my text contains \n (i.e. inside an asciz_table).  



PROBLEM 2 - giberish window titles

   I currently assign titles to dialog boxes by setting the
   XmNdialogTitle resource to an imported compound string in my UIL
   file.  When the compound string happens to contain Kanji
   characters, the title comes out in giberish instead of Kanji.

   My environment variables are all set correctly to Japanese values.
   Other Kanji text in my dialog is displayed correctly.  System text 
   is displayed correctly in Kanji and the titles of system windows are
   displayed in Kanji correctly. 

   WHAT DO I NEED TO DO DIFFERENTLY AND HOW?	  
  


I know there are other people out there attempting to deal with the
same kinds of internationalization issues.  If you identify
yourselves, maybe we can help each other out!


Thanks for listening and double thanks for responding!!!!!!

- Susan Walker
  swalker@bbn.com	
  BBN Software Products
  617) 873-8190