Working with dbf

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

Working with dbf

Postby Ruth » Tue Jul 27, 2021 7:50 am

Dear friends,
our landingpage example works with dbfs.
Please can you help me: What is the difference between "Codifica ANSI" and "Codifica OEM".
Image

i have to use a lot of special characters and therefor have a function
Code: Select all  Expand view
function convertUmlaute( cVData )
    local ctest := ""
    local I := 0

// ´
cVData  :=  STRTRAN(cVData, chr(180), "´" )

// Ä
cVData  :=  STRTRAN(cVData, chr(196), "Ä"   )
 
// Ö
cVData  :=  STRTRAN(cVData, chr(214), "Ö"   )
 
// Ü
cVData  :=  STRTRAN(cVData, chr(220), "Ü" )
 
// ß
cVData  :=  STRTRAN(cVData, chr(223), "ß" )
 
// à
cVData  :=  STRTRAN(cVData, chr(224), "à" )
 
// á
cVData  :=  STRTRAN(cVData, chr(225), "á" )

// ä
cVData  :=  STRTRAN(cVData, chr(228), "ä"   )

// ö
cVData  :=  STRTRAN(cVData, chr(246), "ö"   )
 
// ü
cVData  :=  STRTRAN(cVData, chr(252), "ü"   )
   
return(cVData)

that is called for example from here:
Code: Select all  Expand view


use ( cTMPPage ) new ALIAS landingpage
logging( "close: " + cTMPPage   )
Close
use ( cTMPPage ) new ALIAS landingpage

index on field->ID  TAG TmpB5Nr TO TEMP5 TEMPORARY
do while .not. eof()
  if field->ready = .T.
   if field->LANGUAGE  = cPage
      nRecords += 1
      AADD( aRelationship_DBF, ( "REC" + "_" + ALLTRIM( STR( nRecords ) ) + "_"  )  )

     if VALTYPE( field->ID ) = "N"
        hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( field->ID )  
     
     elseif VALTYPE( field->ID ) = "D"
         hHash_DBF[ "REC" + "_" + ALLTRIM( STR(nRecords ) ) +"_ID" ] = dtoc( field->ID )  
     
      elseif VALTYPE( field->ID ) = "C"  .or. VALTYPE( field->ID ) = "M"
         if LEN( ALLTRIM( field->ID ) ) = 0
            hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( field->ID )
         else
            hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( CONVERTUMLAUTE (  field->ID  ) )
         endif
      else  
         hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( field->ID )
      endif
 

but if I input a special character in "Codifica OEM" mode it is not showing correctly on my site...

Image
Image
http://winhotel.space/lp/bergland_sillian/landingpage3.prg?sprache=it

would it be better to work with "codifica ANSI" in general?

thank you a lot and kind regards
ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: Working with dbf

Postby Enrico Maria Giordano » Tue Jul 27, 2021 8:18 am

OEM is for the older MS-DOS text.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Working with dbf

Postby Carles » Tue Jul 27, 2021 12:26 pm

Ruth,

Your dbf will be encoded in ansi and not in utf8. I recommend that you code on your page if you use dbf as follows

<meta charset = "ISO-8859-1">

If you have the data in the dbf in utf8, you can use the encoding of your page with utf8

<meta charset = "utf-8">

You should be aware of 3 situations if you use dbfs with harbour. As you have your encoded table. As you have encoded your code. and as you encode your web page
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1135
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: Working with dbf

Postby Ruth » Thu Jul 29, 2021 7:45 am

thank you two very much. this did the trick...now everything is showing fine when I put it manually on the dbfs. now we are building a backend for the user and i will post again :-) kind regards to all of you and have a nice day
ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 15 guests

cron