Página 1 de 1

Ansi-OEM conversion in DBF

Publicado: Lun Sep 18, 2006 8:02 am
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

Ansi-OEM conversion in DBF

Publicado: Lun Sep 18, 2006 10:23 am
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
>

Ansi-OEM conversion in DBF

Publicado: Mar Sep 19, 2006 5:06 am
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
>