Board index » delphi » Unicode for BOLD

Unicode for BOLD


2006-06-15 12:55:50 AM
delphi87
Hi to all,
I have pasted some greek characters into a bold application and they appear
fine. When I save my bold object and then access it again, in the component
there appears to be some unicode to AscII conversion.
Can bold support UNICODE? If not how can I change my program to support
unicode?
Sham.
 
 

Re:Unicode for BOLD

There is the WideString attribute, look in the \Samples\Unicode\ I haven't
actually used it so can not tell you more.
Regards,
Danny
 

Re:Unicode for BOLD

Thanks Daniel,
We maybe moving to Delphi 2006, so the question arises whether this would
resolve the problem?
Has anyone got any ideas on how to use the unicode units in the samples
directory?
Sham.
"Daniel Mauric" <danny at n o s p a m neobee dot net>writes
Quote
There is the WideString attribute, look in the \Samples\Unicode\ I
haven't
actually used it so can not tell you more.

Regards,
Danny


 

Re:Unicode for BOLD

"sham" <XXXX@XXXXX.COM>writes:
Quote
We maybe moving to Delphi 2006, so the question arises whether this would
resolve the problem?
If you plan on using Bold in D2006 it should be the same, as there are no
unicode related changes in D2006 compared to Delphi 7 in the Win32 personality.
Quote
Has anyone got any ideas on how to use the unicode units in the samples
directory?
I think you need to make a new package and add those units, then install in
IDE, and WideString attribute should be available at design time.
Regards,
Danny
 

Re:Unicode for BOLD

Hi Danny,
I tried putting the units in a package but received an error saying
boldatttributestring.pas was part of boldd70util.dpl.
In the model editor there is no widestring attribute.
Any ideas?
Sham.
"Daniel Mauric" <danny at n o s p a m neobee dot net>writes
Quote
"sham" <XXXX@XXXXX.COM>writes:

>We maybe moving to Delphi 2006, so the question arises whether this would
>resolve the problem?

If you plan on using Bold in D2006 it should be the same, as there are no
unicode related changes in D2006 compared to Delphi 7 in the Win32 personality.

>Has anyone got any ideas on how to use the unicode units in the samples
>directory?

I think you need to make a new package and add those units, then install
in
IDE, and WideString attribute should be available at design time.

Regards,
Danny


 

Re:Unicode for BOLD

"sham" <XXXX@XXXXX.COM>wrote
Quote
Hi Danny,
I tried putting the units in a package but received an error saying
boldatttributestring.pas was part of boldd70util.dpl.

In the model editor there is no widestring attribute.

Any ideas?
Hi Sham,
Yes, there are instructions in unit BoldAttributeWideString, you have to add
it manually as you would for the custom attribute types:
// To install this attribute type in your application, add the following to
your
// TypeNameHandle:
//
// ModelName: UniCode
// ExpressionName: WideString
// DelphiName: TBAWideString
// ContentName: WideString
// PMapper: TBoldPMWideString
// Accessor: AsWideString
// NativeType: WideString
// UnitName: BoldAttributeWideString
Regards,
Danny
 

Re:Unicode for BOLD

Thanks for the instructions, I could not find any instructions in
BoldAttributeWideString.pas.
I have done as you said (adding type to typeHandle), and I see wideString as
an attribute in the model editor. I have now set one of my class properties
to WideString and generated the code. However, the interface unit for my
project still contains has my property as TBAString (I was expecting
TBAWideString).
Am I missing a step?
Sham
"Daniel Mauric" <danny at n o s p a m neobee dot net>writes
Quote

"sham" <XXXX@XXXXX.COM>wrote

>Hi Danny,
>I tried putting the units in a package but received an error saying
>boldatttributestring.pas was part of boldd70util.dpl.
>
>In the model editor there is no widestring attribute.
>
>Any ideas?

Hi Sham,

Yes, there are instructions in unit BoldAttributeWideString, you have to
add
it manually as you would for the custom attribute types:

// To install this attribute type in your application, add the following
to
your
// TypeNameHandle:
//
// ModelName: UniCode
// ExpressionName: WideString
// DelphiName: TBAWideString
// ContentName: WideString
// PMapper: TBoldPMWideString
// Accessor: AsWideString
// NativeType: WideString
// UnitName: BoldAttributeWideString

Regards,
Danny


 

Re:Unicode for BOLD

Hi,
Instead of having the // ModelName: UniCode, I replaced UniCode with
WideString and the interface unit is showing TBAWideString.
I have evolved the database and the string column has been dropped and a new
column has been created with character set ISO 8859.
When running the app, I am still seeing the data entered (in Greek) as weird
character when retrieved from the database.
Do I need to change the tboldEdit components?
Sham
"sham" <XXXX@XXXXX.COM>writes
Quote
Thanks for the instructions, I could not find any instructions in
BoldAttributeWideString.pas.

I have done as you said (adding type to typeHandle), and I see wideString
as an attribute in the model editor. I have now set one of my class
properties to WideString and generated the code. However, the interface
unit for my project still contains has my property as TBAString (I was
expecting TBAWideString).

Am I missing a step?

Sham
"Daniel Mauric" <danny at n o s p a m neobee dot net>writes
news:XXXX@XXXXX.COM...
>
>"sham" <XXXX@XXXXX.COM>wrote
>
>>Hi Danny,
>>I tried putting the units in a package but received an error saying
>>boldatttributestring.pas was part of boldd70util.dpl.
>>
>>In the model editor there is no widestring attribute.
>>
>>Any ideas?
>
>Hi Sham,
>
>Yes, there are instructions in unit BoldAttributeWideString, you have to
>add
>it manually as you would for the custom attribute types:
>
>// To install this attribute type in your application, add the following
>to
>your
>// TypeNameHandle:
>//
>// ModelName: UniCode
>// ExpressionName: WideString
>// DelphiName: TBAWideString
>// ContentName: WideString
>// PMapper: TBoldPMWideString
>// Accessor: AsWideString
>// NativeType: WideString
>// UnitName: BoldAttributeWideString
>
>Regards,
>Danny
>
>


 

Re:Unicode for BOLD

"sham" <XXXX@XXXXX.COM>wrote
Quote
Am I missing a step?
hmm, I just tried it here and the codegen did generate the following :
TNewClass = class(TBusinessClassesRoot)
private
function _Get_M_NewAttribute: TBAWideString;
function _GetNewAttribute: WideString;
procedure _SetNewAttribute(const NewValue: WideString);
protected
public
property M_NewAttribute: TBAWideString read _Get_M_NewAttribute;
property NewAttribute: WideString read _GetNewAttribute write
_SetNewAttribute;
end;
So, don't know what could be the problem you're having, try to create a test
app and repeat all steps again, I guess.
Regards,
Danny
 

Re:Unicode for BOLD

"sham" <XXXX@XXXXX.COM>wrote
Quote
When running the app, I am still seeing the data entered (in Greek) as
weird
character when retrieved from the database.

Do I need to change the tboldEdit components?
I suspect you are correct and it is the controls that don't really support
unicode, try to test with TNT controls
www.tntware.com/delphicontrols/unicode
Unforunately, these are not Bold aware, but try to fill them manually to see
if that will work.
Regards,
Danny
 

Re:Unicode for BOLD

Hi Danny,
I have replaced the TBoldEdit component with a TNTEdit component and at the
object space level, the unicode strings seem correct (i.e. assigning unicode
string to object property from a TNTEdit component and then showing it in
another TNTEdit component).
What I found by using by tracing the SQL statements (using an IBSQLMonitor
component) is that the sql generated (for the UPDATE statement) does not
have the property as the unicode string entered (i.e. AscII characters ???
etc used).
In my model editor, the property is wideString and the PMapper name is set
to TBoldPMWideString. I have also created the database using the character
set ISO_8859_1.
Any ideas why the update statement is not using the property as a unicode
string?
Sham.
"Daniel Mauric" <danny at n o s p a m neobee dot net>writes
Quote

"sham" <XXXX@XXXXX.COM>wrote

>Am I missing a step?

hmm, I just tried it here and the codegen did generate the following :

TNewClass = class(TBusinessClassesRoot)
private
function _Get_M_NewAttribute: TBAWideString;
function _GetNewAttribute: WideString;
procedure _SetNewAttribute(const NewValue: WideString);
protected
public
property M_NewAttribute: TBAWideString read _Get_M_NewAttribute;
property NewAttribute: WideString read _GetNewAttribute write
_SetNewAttribute;
end;

So, don't know what could be the problem you're having, try to create a
test
app and repeat all steps again, I guess.

Regards,
Danny


 

Re:Unicode for BOLD

Hi,
I found that dbExpress and IBX do not support unicode. Is this correct?
If so, which Firebird components should I use and which bold adapter
component do I use (there are only BoldDatabaseAdapterDBX and
BoldDatabaseAdapterIB components available).
Could the above be the reason for the unicode problems?
Sham.
"sham" <XXXX@XXXXX.COM>writes
Quote
Hi Danny,

I have replaced the TBoldEdit component with a TNTEdit component and at
the object space level, the unicode strings seem correct (i.e. assigning
unicode string to object property from a TNTEdit component and then
showing it in another TNTEdit component).

What I found by using by tracing the SQL statements (using an IBSQLMonitor
component) is that the sql generated (for the UPDATE statement) does not
have the property as the unicode string entered (i.e. AscII characters ???
etc used).

In my model editor, the property is wideString and the PMapper name is set
to TBoldPMWideString. I have also created the database using the character
set ISO_8859_1.

Any ideas why the update statement is not using the property as a unicode
string?

Sham.
"Daniel Mauric" <danny at n o s p a m neobee dot net>writes
news:XXXX@XXXXX.COM...
>
>"sham" <XXXX@XXXXX.COM>wrote
>
>>Am I missing a step?
>
>hmm, I just tried it here and the codegen did generate the following :
>
>TNewClass = class(TBusinessClassesRoot)
>private
>function _Get_M_NewAttribute: TBAWideString;
>function _GetNewAttribute: WideString;
>procedure _SetNewAttribute(const NewValue: WideString);
>protected
>public
>property M_NewAttribute: TBAWideString read _Get_M_NewAttribute;
>property NewAttribute: WideString read _GetNewAttribute write
>_SetNewAttribute;
>end;
>
>So, don't know what could be the problem you're having, try to create a
>test
>app and repeat all steps again, I guess.
>
>Regards,
>Danny
>
>


 

Re:Unicode for BOLD

"sham" <XXXX@XXXXX.COM>wrote
Quote
I found that dbExpress and IBX do not support unicode. Is this correct?
If so, which Firebird components should I use and which bold adapter
component do I use (there are only BoldDatabaseAdapterDBX and
BoldDatabaseAdapterIB components available).

Could the above be the reason for the unicode problems?
You got me interested so I wrote a test app and both adapters work when
configured correctly. I found it neccesary to specify ISO8859_1 as the
ServerCharSet in SQLConnection.Params for DBX and lc_ctype=ISO8859_1 in
IBDatabase params for IBX.
Now, IB/FB apparently store unicode as UTF8, and we are expected to perform
conversions, so I had to modify these two methods:
TBoldPMWideString.ValueToParam
...
Param.AsString := UTF8Encode( aWideString.asWideString );
...
and
TBoldPMWideString.ValueFromField
...
aWideString.AsWideString := UTF8Decode ( Field.AsString );
...
As for the GUI controls I found the use of TBoldStringFollowerController
class to be the problem, as it is used in all Bold aware controls. So to have
unicode Bold aware controls one would have to:
- make controls inherit from appropriate TNT controls
- replace TBoldStringFollowerController with
TBoldWideStringFollowerController
Regards,
Danny