View Full Version : Unicode characters
Ron
July 5, 2006, 11:37:06
Hi,
When we use some unicode characters such as "åçéăÿìµÁÂỡỢ" is will be converted to questionmarks... whats the problem?
We have the latest version with SP2.
More info: this unicode characters are already in the database (sqlserver) en presented good, in a webform. When we save it to pdf or word .. then there are questionmarks...
Björn Meyer
July 5, 2006, 14:35:09
Hi Ron
How is the document loaded into the TX Text Control and which format do you use?
Ron
July 5, 2006, 14:43:19
Björn
It is a MS Word template in RTF.
private bool FillDocument(String pstrTemplate, String pstrDocument)
{
String pstrDocumentNew;
Tx4oleLib.TXLicenseManager objLC;
Tx4oleLib.TXTextControlClass objTX;
objLC = new Tx4oleLib.TXLicenseManagerClass();
objTX = new Tx4oleLib.TXTextControlClass();
objTX.EnableAutomationServer();
try
{
// load source document
objTX.Load( pstrTemplate, 0, 5, false );
...
Ron
July 19, 2006, 12:46:37
Björn,
Do you have a workaround ?
Kind regards,
Ron
Gunnar Giffey
July 19, 2006, 17:59:22
Hi Ron,
Could you test the following, so that we can determine the exact cause of your problem?
Please use as font Arial Unicode MS font for your text, e.g. select the whole content and set the font to 'Arial Unicode MS'.
Ron
July 25, 2006, 11:43:45
I have changed the template... all text is "Arial Unicode MS". But when i select some unicode chars with "Character map" and paste them in the database it works fine. The text is displayed good in the form. When i push the button to present the document... some characters are questionmarks
Ron
July 25, 2006, 14:04:30
Here's the function for replacing the text...
private void VervangWordVariabele( Tx4oleLib.TXTextControlClass tx
,String pstrZoekText
,String pstrZoekReplaceWith
,bool pblnUseWildCards)
{
int nextPos = 0;
String zoekText;
zoekText = "[[" + pstrZoekText + "]]";
do
{
nextPos = tx.Find( zoekText, nextPos, 16 );
if ( nextPos != -1 )
{
tx.SelText = pstrZoekReplaceWith;
}
}
while ( nextPos != -1 );
When the position is found the string "pstrZoekReplaceWith" contains the (database) string with the unicode characters. When tx.SelText = pstrZoekReplaceWith is carried out.... tx.text already contains the wrong characters.
Björn Meyer
July 27, 2006, 15:36:56
Hello Ron
All string based properties like Text, SelText, TableCellText or FieldText accept ANSI strings. Unicode characters can be only inserted using the LoadFromMemory method.
In your case, you should select the specific string with the Find method to load the Unicode string using the LoadFromMemory method (CurSelection parameter = true).
Ron
July 28, 2006, 09:52:15
Björn,
Can you help me with the code?
Kinds regards,
Ron
August 4, 2006, 14:59:49
Instead of objTX.Load( pstrTemplate, 0, 5, false );, i must use objTX.Loadfrommemory( pstrTemplate, 5, true) ???:confused:
Ron
August 8, 2006, 09:59:59
When I use tx.loadfrommemory( pStrReplace, 6, true) I get the error message "Invalid Property Value". What's the problem?
Björn Meyer
August 21, 2006, 15:07:02
Hello Ron
If you have a Unicode text format, format 6 or 7 should be used (Windows Unicode = 6). Are you sure that you are using Unicode characters? The characters "åçéa(ÿìµÁÂo+~O+." are normal ASCII characters that can be inserted using the Text or SelText property.
Please try the following: Copy this string åçéa(ÿìµÁÂo+~O+. to clipboard and insert it into the shipped sample TXWords. Export the document to PDF. Are the character exported properly to PDF?
Ron
August 22, 2006, 08:16:28
Björn,
I know that the "normal" characters are no problem. But you told me to use LoadFromMemory... i got an error on that.
http://www.theimagingsourceforums.com/showpost.php?p=18578&postcount=11
See also:
http://www.theimagingsourceforums.com/showpost.php?p=18428&postcount=7
Björn Meyer
August 28, 2006, 10:46:26
Ron
Please provide me a sample document dump, so that I can test it on my own. Thanks so much.
Ron
August 28, 2006, 10:55:15
Björn,
I want only to know why i got an error when i used loadfrommemory. Can you give me an example (c#) with a statement with "LoadFromMemory" ?