For Programmers: Free Programming Magazines  


Home > Archive > Clarion > June 2006 > Chinese text









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Chinese text
Mark Russon

2006-06-17, 7:56 am

I am attempting to do something that I think has been addressed on this
forum before, but I can't find the answers I need. I have created a form in
Clarion with fields of type "text" that I want to enter Chinese characters
in. I have set up the fonts and regional settings on my Windows XP machine
to allow me to type the Chinese characters into the field. But I am unclear
on what data type to use for that text field. If I simply use a string,
whatever I write to the database comes up as ????? Since the SQL database
(MS SQL Server 2000) saves it as an nvarchar which is two bytes per
character, how do I tranlsate that into the right data type on my Clarion
form for entering the characters? I'm missing a link here.


karim

2006-06-17, 7:56 am

i think you can use cstring

clackmannan

2006-06-17, 7:56 am


Mark Russon wrote:
> I am attempting to do something that I think has been addressed on this
> forum before, but I can't find the answers I need. I have created a form in
> Clarion with fields of type "text" that I want to enter Chinese characters
> in. I have set up the fonts and regional settings on my Windows XP machine
> to allow me to type the Chinese characters into the field. But I am unclear
> on what data type to use for that text field. If I simply use a string,
> whatever I write to the database comes up as ????? Since the SQL database
> (MS SQL Server 2000) saves it as an nvarchar which is two bytes per
> character, how do I tranlsate that into the right data type on my Clarion
> form for entering the characters? I'm missing a link here.


For the most part, ignore the 2-byte stuff and the DB back end. Save
everything as a regular string and you'll be fine.

Using Japanese as an example, the problem with ??? in a text field is
probably because

- you're not using a font that supports your DB character set (the
text fields needs to be using MS Mincho, @MS Mincho, or similar)

- you are using the right font, but haven't set the character set
(CHARSET:SHIFTJIS)

- your default locale in Windows isn't set to a DBCS locale

HTH,
Paul

Mark Russon

2006-06-17, 7:56 am

I defined a text control and I've tried using both String type and CString
type. Still to no avail. I'm wondering if something is not set up properly
with my Windows regional settings. I installed all of the Chinese fonts,
and I simply toggle to Chinese mode with Alt-Shift. Then it remaps my
keyboard and lets me type Chinese characters into the Clarion form--or at
least it appears that way. It's like there's a virtual control over my text
control, as it lets me type characters (that show up fine) until I hit
ENTER, which seems to enter the characters into the text control. Then they
turn into ???????

I've tried different fonts on the control as you suggested. I guess what
confuses me is how these two-byte Chinese characters can even save into a
String type variable. How do I set a particular character set on that text
control? You mentioned CHARSET:SHIFTJIS.

Thanks again.
"clackmannan" <clackmannan@hotmail.com> wrote in message
news:1150407618.403223.77310@r2g2000cwb.googlegroups.com...
>
> Mark Russon wrote:
>
> For the most part, ignore the 2-byte stuff and the DB back end. Save
> everything as a regular string and you'll be fine.
>
> Using Japanese as an example, the problem with ??? in a text field is
> probably because
>
> - you're not using a font that supports your DB character set (the
> text fields needs to be using MS Mincho, @MS Mincho, or similar)
>
> - you are using the right font, but haven't set the character set
> (CHARSET:SHIFTJIS)
>
> - your default locale in Windows isn't set to a DBCS locale
>
> HTH,
> Paul
>



clackmannan

2006-06-17, 7:56 am


Mark Russon wrote:
> I defined a text control and I've tried using both String type and CString
> type. Still to no avail. I'm wondering if something is not set up properly
> with my Windows regional settings.


Probably, yes. It's the one thing most people forget to do.

> I installed all of the Chinese fonts,
> and I simply toggle to Chinese mode with Alt-Shift. Then it remaps my
> keyboard and lets me type Chinese characters into the Clarion form--or at
> least it appears that way. It's like there's a virtual control over my text
> control, as it lets me type characters (that show up fine) until I hit
> ENTER, which seems to enter the characters into the text control. Then they
> turn into ???????


Yup, that sounds like a typical font problem.
It's been a while since I've had to do it, but IIRC in XP you need to
go to the Advanced tab of Regional and Language control panel, then
select the default language for 16bit apps (IE Japanese), and check the
box at the bottom that says "default user account settings"

> I've tried different fonts on the control as you suggested. I guess what
> confuses me is how these two-byte Chinese characters can even save into a
> String type variable.


I stopped worrying about that when my test team told me it looked OK
and I hadn't had to make my data fields twice as large, like I thought
I was going to have to.

> How do I set a particular character set on that text
> control? You mentioned CHARSET:SHIFTJIS.


Something along the lines of
text_control{prop:foname} = "@ms mincho"
text_control{prop:charset} = CHARSET:SHIFTJIS

If you still can't get it working let me know, somewhere around here I
have a simple example app that shows how to make it work.

HTH,
Paul

Mark Russon

2006-06-17, 7:56 am

I should mention that after accepting data from these text controls, I'm
writing the record to a SQL table with an embedded SQL statement:

insert into chinesetest (name) select ''' & loc:name & ''''
(also tried with explicit "N" identifier going into nVarChar type)
insert into chinesetest (name) select N''' & loc:name & ''''

I've also tried retrieving data from the same database that I have
successfully inserted Chinese text into from the back end, and it shows
nothing in my text field.

I tried everything else you said and still have same results. Would like to
see sample app if you can dig it out. Thanks for your help!

Mark

"clackmannan" <clackmannan@hotmail.com> wrote in message
news:1150421556.309216.231090@r2g2000cwb.googlegroups.com...
>
> Mark Russon wrote:
>
> Probably, yes. It's the one thing most people forget to do.
>
>
> Yup, that sounds like a typical font problem.
> It's been a while since I've had to do it, but IIRC in XP you need to
> go to the Advanced tab of Regional and Language control panel, then
> select the default language for 16bit apps (IE Japanese), and check the
> box at the bottom that says "default user account settings"
>
>
> I stopped worrying about that when my test team told me it looked OK
> and I hadn't had to make my data fields twice as large, like I thought
> I was going to have to.
>
>
> Something along the lines of
> text_control{prop:foname} = "@ms mincho"
> text_control{prop:charset} = CHARSET:SHIFTJIS
>
> If you still can't get it working let me know, somewhere around here I
> have a simple example app that shows how to make it work.
>
> HTH,
> Paul
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com