Avatar of Regie Velasco
Regie Velasco
 asked on

sql query via vfp

i have sql table with field named arabdes with type nvarchar (100) and with arabic letter entries, i'm trying to retrieve via visual foxpro, but i keep getting ????? instead of the data itself, and the field type on my query is only character and not varchar, can anyone help me with to correctly retrieve this information correctly, thanks in advance

Avatar of undefined
Last Comment
Regie Velasco

8/22/2022 - Mon
Pavel Celba

Visual FoxPro does not process Unicode (nvarchar) strings without explicit conversion obviously.
What Code Page do you use in VFP?
Are you able to display/enter such characters directly in VFP?
What ODBC driver do you use?

If you would like to obtain the data without any conversion then you may issue the following query:
SELECT arabdes, CAST(arabdes AS varbinary(200)) arabdesCNV FROM YourTable

And the arabdesCNV column will create a memo field which will contain Unicode text. Depending on FoxPro Code Page used you'll be able to display the memo after conversion or not... The best function for conversion is STRCONV() or possibly also CPCONVERT().

Unicode characters is possible to print via new report engine with your own Report listener and/or display in 3rd party OLE controls. Everything is rather complex...

More about Unicode in VFP is here: https://www.west-wind.com/presentations/foxunicode/foxunicode.html
All VFP International features are described e.g. here: http://stevenblack.com/intl-vfp/
Regie Velasco

Thanks a bunch for the suggestion, will try to work on it and reply for result
Olaf Doschke

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Pavel Celba

The Arabic characters should be displayed correctly when the VFP Code Page is set to 1256 and the Windows language for Non-Unicode programs is set to Arabic (available in Regional settings).
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Regie Velasco

Thanks pcelba for the code page settings, been searching it on google for a while and ur my answered prayer
Regie Velasco

Thanks a bunch olaf, will try it as well
Regie Velasco

Got my problem solved guys, thanks a lot for the help, you guys are awesome
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.