Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Charset, encoding
Message
From
29/06/2011 12:16:14
 
General information
Forum:
Visual FoxPro
Category:
Internet applications
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Application:
Desktop
Miscellaneous
Thread ID:
01516651
Message ID:
01516714
Views:
46
Very nice, it works beautifully :-)

Thanks Martina !

(Little note: The last character of the string is dropped. In your code, I changed:
	do while lii < len(lcstring)
to
	do while lii <= len(lcstring)
>
>lcCT=""
>=GetCT_ISO12WIN(@lcCT)
>
>?SYS(15,lcCT,FromQP("G=E9rard La Boutique"))
>
>PROCEDURE GetCT_ISO12WIN(lcCT)
>*@lcCT - Code table for SYS(15) 
>
>LOCAl lcCT
>lcCT=""
>FOR lii=1 TO 255
>    lcCT=lcCT+CHR(lii)
>NEXT
>lcCT=STUFF(lcCT,176,1,CHR(186))
>ENDPROC
>
>PROCEDURE FromQP(lcString)
>LOCAL lcOut,lii,lcChar
>lcOut=""
>lii=1
>DO WHILE lii<LEN(lcString)
>   lcChar=SUBSTR(lcString,lii,1)
>   IF lcChar="="
>      DO CASE
>         CASE SUBSTR(lcString,lii+2,1)="X"
>              lcOut=lcOut+CHR(EVALUATE("0x"+SUBSTR(lcString,lii+1,1)))
>
>         CASE SUBSTR(lcString,lii+1,2)=" A"
>              lcOut=lcOut+CHR(13)+CHR(10)
>
>         CASE SUBSTR(lcString,lii+1,2)=" 9"
>              lcOut=lcOut+CHR(9)
>
>         OTHERWISE
>              lcOut=lcOut+CHR(EVALUATE("0x"+SUBSTR(lcString,lii+1,2)))
>      ENDCASE
>      lii=lii+3
>   ELSE
>      lcOut=lcOut+lcChar
>      lii=lii+1
>   ENDIF
>ENDDO
>RETURN lcOut
>
>
>MartinaJ
>
>>Thanks Brandon,
>>
>>This would require us to write a charset converter (a simple one). Before we do this, I wanted to know if a native function (a la STRCONV()) was available. An external tool would be suitable also, but if we can avoid it...
>>
>>>>Hi all,
>>>>
>>>>We receive VCF files that include special Charset encoding:
>>>>
>>>>
>>>>FN;CHARSET=ISO-8859-1;ENCODING=QUOTED-PRINTABLE:G=E9rard La Boutique 
>>>>
>>>>
>>>>We want to convert this string to :
>>>>
>>>>
>>>>FN;Gérard La Boutique
>>>>
>>>>
>>>>How to decode this string according to this Charset ?
>>>
>>>
>>>lcFileContents=filetostr(lcFileNameWithPath)
>>>lcFileContents=strtran(lcFileContents,[FN;CHARSET=ISO-8859-1;ENCODING=QUOTED-PRINTABLE:],[FN;])
>>>** specific unescaping here
>>>lcFileContents=strtran(lcFileContents,[=E9],[é])
>>>strtofile(lcFileContents,lcFileNameWithPath)
>>>
>>
>>
>>>>Hi all,
>>>>
>>>>We receive VCF files that include special Charset encoding:
>>>>
>>>>
>>>>FN;CHARSET=ISO-8859-1;ENCODING=QUOTED-PRINTABLE:G=E9rard La Boutique 
>>>>
>>>>
>>>>We want to convert this string to :
>>>>
>>>>
>>>>FN;Gérard La Boutique
>>>>
>>>>
>>>>How to decode this string according to this Charset ?
>>>
>>>
>>>lcFileContents=filetostr(lcFileNameWithPath)
>>>lcFileContents=strtran(lcFileContents,[FN;CHARSET=ISO-8859-1;ENCODING=QUOTED-PRINTABLE:],[FN;])
>>>** specific unescaping here
>>>lcFileContents=strtran(lcFileContents,[=E9],[é])
>>>strtofile(lcFileContents,lcFileNameWithPath)
>>>
Gensoft Sàrl
Christian Carron
Previous
Reply
Map
View

Click here to load this message in the networking platform