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.

Ansi-OEM conversion in DBF

Xailer English public forum
Responder
Gejza Horvath
Mensajes: 281
Registrado: Mar Ago 15, 2006 1:50 pm

Ansi-OEM conversion in DBF

Mensaje por Gejza Horvath »

Hi,
in my DBF-s are fields coded in OEM character set, but the TDbfDatSource opens the files
with ANSI coding (default by Windows). I'm looking for setting to tell to datasource open
the file with OEM coding. I found it only in TAdsDataSource, property nCharType. How to do
this?
Gejza Horvath
Slovakia
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9440
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Ansi-OEM conversion in DBF

Mensaje por ignacio »

Gejza,
I suggest you change the format to ANSI, if not, you are going have a lot of
troubles, for example, editing. In case you do not want to change the
format, you may use ADS or create calcultaed fields that use OemToAnsi() but
I do not recommend this last one.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:450e3793$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hi,
>
> in my DBF-s are fields coded in OEM character set, but the TDbfDatSource
> opens the files with ANSI coding (default by Windows). I'm looking for
> setting to tell to datasource open the file with OEM coding. I found it
> only in TAdsDataSource, property nCharType. How to do this?
>
>
> Gejza Horvath
> Slovakia
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Ingo
Mensajes: 330
Registrado: Mié Jul 05, 2006 3:58 pm

Ansi-OEM conversion in DBF

Mensaje por Ingo »

Hi Gejza,
I'm using modified TDbfDataset's methods (FieldGet(n) and FieldPut(n,x) like
this:
CLASS TDbfDataSet FROM XDbfDataSet
DATA lAnsi INIT .F.
METHOD FieldGet( n )
METHOD FieldPut( n, x )
ENDCLASS
//---------------------------------------------------------- --------------------
METHOD FieldGet( n ) CLASS TDbfDataSet
LOCAL x := ( ::cAlias )->( FieldGet( n ) )
IF !::lAnsi .AND. ValType( x ) $ "CM"
x := TRIM(OemToAnsi( x ))
ENDIF
RETURN x
//---------------------------------------------------------- --------------------
METHOD FieldPut( n, x ) CLASS TDbfDataSet
IF !::lAnsi .AND. ValType( x ) == "C"
( ::cAlias )->( FieldPut( n, AnsiToOem( x ) ) )
ELSE
( ::cAlias )->( FieldPut( n, x ) )
ENDIF
RETURN x
When creating a TDbfDataset from a ANSI-Dbf-file I set oDbfDataset:lAnsi to
..T. otherwise it will be .F. and changing characters of the dabasefields
automatically to ANSI.
Maybe this can help you.
Regards
Ingo
"Gejza Horvath" <_hsoftkn@nextra.sk> schrieb im Newsbeitrag
news:450e3793$[email=1@news.xailer.com...]1@news.xailer.com...[/email]
> Hi,
>
> in my DBF-s are fields coded in OEM character set, but the TDbfDatSource
> opens the files with ANSI coding (default by Windows). I'm looking for
> setting to tell to datasource open the file with OEM coding. I found it
> only in TAdsDataSource, property nCharType. How to do this?
>
>
> Gejza Horvath
> Slovakia
>
Responder