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
Regie VelascoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pcelbaCommented:
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 VelascoAuthor Commented:
Thanks a bunch for the suggestion, will try to work on it and reply for result
Olaf DoschkeSoftware DeveloperCommented:
CursorSetProp("MapVarchar",.t.,0) before SQLExec or execution of remote views to get varchars in VFP, notice varchars still only go up to 254 chars. Also see Sys(987). You'll also need an ANSI codepage having that arabic characters, if you go for that mapping, it's not magic though, if you don't run with a codepage having arabic this mapping always gives you ?????- If you keep translation off, you get the data 1:1 but will need a unicode capable control to display it.

https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=608

Bye, Olaf.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ensure Business Longevity with As-A-Service

Using the as-a-service approach for your business model allows you to grow your revenue stream with new practice areas, without forcing you to part ways with existing clients just because they don’t fit the mold of your new service offerings.

pcelbaCommented:
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).
Regie VelascoAuthor Commented:
Thanks pcelba for the code page settings, been searching it on google for a while and ur my answered prayer
Regie VelascoAuthor Commented:
Thanks a bunch olaf, will try it as well
Regie VelascoAuthor Commented:
Got my problem solved guys, thanks a lot for the help, you guys are awesome
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.