In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Character code page conversion

FastReport for Xailer & [x]Harbour (English/Spanish)
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Character code page conversion

Postby dmajkic » Fri Oct 31, 2014 11:06 am

How does XFR perform character conversion via AddArray()and AddDbf()? Is it unicode based?
I have data in different formats (CP1250, CP852, CP1251), and I would like to display it.
I can use Harbour built in conversion od HB_TRANSLATE(), but I am not sure what target FRX codepage is.
What is the best way to do that?
--
Dusan Majkic
Wings Software
User avatar
ignacio
Site Admin
Posts: 8562
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Character code page conversion

Postby ignacio » Fri Oct 31, 2014 11:43 am

dmajkic escribió el vie, 31 octubre 2014 11:06
How does XFR perform character conversion via AddArray()and AddDbf()? Is it unicode based?
I have data in different formats (CP1250, CP852, CP1251), and I would like to display it.
I can use Harbour built in conversion od HB_TRANSLATE(), but I am not sure what target FRX codepage is.
What is the best way to do that?
--
Dusan Majkic
Wings Software

Dear Sir,
I suggest you post that question on FR support forums. Maybe other FRX users can give you some clue on this. Sorry for not giving a better answer.
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Character code page conversion

Postby dmajkic » Fri Oct 31, 2014 2:11 pm

Quote:
I suggest you post that question on FR support forums

I have data in CP852 in DBF.
In delphi FastReport, which is unicode I do manual CP852-> UnicodeString (delphi internal unicode string type). Delphi FR Datasets work with UnicodeStrings, which are supplied, and that works Ok.
Spirin FR version uses Harbour internal conversion, which works automatic using. It uses older Delphi, which is not unicode, but uses Font.Charset. This works fine when _SET_CODEPAGE, and _SET_DBCODEPAGE are set.
Xailr FRX seems to ignore Font.Charset - this propbably means it is compiled with Unicode strings. But it is unclear how and when is translation from Habour string to Delphi unicode string performed.
So, how should I prepare string data for FRX? If Unicode is supported, how can I utilize it? Or does it respect HB translation support?
This very much Xailer FR related quiestin. Please advise.
User avatar
ignacio
Site Admin
Posts: 8562
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Character code page conversion

Postby ignacio » Mon Nov 03, 2014 10:22 am

Hello,
We do not make any conversion. Strings are converted to Delphi basic String type. If you need any conversion you can do it your self on Harbour or FR side:
::oFastReport1:SetProperty( "Font", "Charset", 1 )
Regards
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
User avatar
ignacio
Site Admin
Posts: 8562
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Character code page conversion

Postby ignacio » Mon Nov 03, 2014 11:27 am

ignacio escribió el lun, 03 noviembre 2014 10:22
Hello,
We do not make any conversion. Strings are converted to Delphi basic String type. If you need any conversion you can do it your self on Harbour or FR side:
::oFastReport1:SetProperty( "Font", "Charset", 1 )
Regards

BTW, I have just check that the code above did not work correctly. Is fixed and it will be available on next release.
In any case you can set the charset directly on the memo controls:
::oFastReport1:SetProperty( "Memo1", "Font.Charset", 1 )
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Character code page conversion

Postby dmajkic » Mon Nov 03, 2014 1:19 pm

Quote:
BTW, I have just check that the code above did not work correctly. Is fixed and it will be available on next release.
In any case you can set the charset directly on the memo controls:

If delphi used to compile FastReport in frx.dll is Unicode based, which is Delphi2009 and newer, than the delphi string type in FastReport is UnicodeString.
All Unicode edit controls ignore Font.Charset.
To make it work correctly with UnicpdeString it is necessary to perform conversion using Harbour C api, and convert from HB code page to UnicodeString. HB_TRANSLATE() does that on PRG level, so there must be equvivalent HB C API.
Thank you for prompt response.
User avatar
ignacio
Site Admin
Posts: 8562
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Character code page conversion

Postby ignacio » Mon Nov 03, 2014 1:42 pm

dmajkic escribió el lun, 03 noviembre 2014 13:19
If delphi used to compile FastReport in frx.dll is Unicode based, which is Delphi2009 and newer, than the delphi string type in FastReport is UnicodeString.
All Unicode edit controls ignore Font.Charset.

FR after this change:
::oFastReport1:SetProperty( "Font", "Charset", SYMBOL_CHARSET )


dmajkic escribió el lun, 03 noviembre 2014 13:19

To make it work correctly with UnicpdeString it is necessary to perform conversion using Harbour C api, and convert from HB code page to UnicodeString. HB_TRANSLATE() does that on PRG level, so there must be equvivalent HB C API.


I believe that conversion is unnecessary.
Regards,


Attached files
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Character code page conversion

Postby dmajkic » Mon Nov 03, 2014 2:11 pm

Quote:
FR after this change

Looks fine!
Is this version released?
User avatar
ignacio
Site Admin
Posts: 8562
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Character code page conversion

Postby ignacio » Mon Nov 03, 2014 2:51 pm

dmajkic escribió el lun, 03 noviembre 2014 14:11
Quote:
FR after this change

Looks fine!
Is this version released?

Yes, the console libraries. Xailer libraries will be available on next Xailer realease.
Regards,
http://www.xailer.com/download?en&file=103
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
dmajkic
Posts: 21
Joined: Wed Sep 24, 2014 12:48 pm

Character code page conversion

Postby dmajkic » Fri Nov 07, 2014 8:40 am

Just to confirm - it works fine.
Thank you!

Return to “FastReport”