Welcome! Log In Create A New Profile

Advanced

[WD21] Using Unicode?

Posted by Ola 
Ola
[WD21] Using Unicode?
May 26, 2016 05:26PM
Hi all,

I have updated my main app to WD21, and at he same time I am also doing a major overhaul for it. One thing that I would like to do is upgrade the app to unicode.

I remember reading about some unicode problems, so before diving into it, I would like know whether Windev 21's unicode is OK and mature? Are there any problems using it? Does it really work across platforms without hic-ups?

And what is the best method to convert a rather large app to unicode, with hundreds or even thousands of string and memo fields? Do I have to go through each item in the analysis, or is there a more intelligent way to do it?

As always, any hints and tips will be highly appreciated.

Best regards
Ola
Fabrice Harari
Re: [WD21] Using Unicode?
May 26, 2016 08:04PM
Hi Ola,

unicode is mature and you can use it...

that said... Unicode is NOT universal, and as such, if you try to use ONLY unicode in your project, you may have some problems, such as: URLs (still ansi, most of the time) and interaction with webservices (mostly ansi), system function under windows (like flistfile, by example), etc...

So the best way to switch to unicode includes:
- in the project configuration, switch to unicode as default. This means that any string declare as "is string" will now be unicode.
- then you have to go throught all your UI (windows ans such) and change each field to unicode (I do not know of any universal way of doing that)
- then you have to go in your analysis and change each string var to unicode

so that's a LOT of work.

So if you don't NEED it, you may want to forget about it, especially because if you are not working in "exotic" languages, there will be no advantage for you.

Best regards
Ola
Re: [WD21] Using Unicode?
May 26, 2016 10:00PM
Thanks Fabrice,

I appreciate your comments. Seems I will be skipping the conversion at this time and wait until PCSoft comes out with some usable tool to do the heavy work. I wonder why they haven't already done it -- shouldn't be too difficult for them...

Best regards
Ola
Peter Holemans
Re: [WD21] Using Unicode?
May 27, 2016 09:43AM
Hi Ola,

Since V18, all of my projects are Unicode.
I started using it while I had to do several WD & WB projects that had to incorporate Korean and Chinese character sets or talk to unicode encoded databases.

It is completely mature and I never had any of the issues that Fabrice describes, nor talking to web services (which are mostly utf-8 encoded) or Windows API's on recent infrastructure (Server 2008 R2 -> 2014 / Windows 7 -> 10), or SQL Server databases in either unicode or ansi format.

On the other hand there are lots of issues if you're trying to work with unicode resources from an ansi WX configuration (like accessing unicode databases using hexecutesqlquery). Rarely I noticed any issues the other way around.

For most Windows api calls we explicitely declare the string variables to pass as ASCIIZ strings which works fine if you transfer them to a unicode configuration. The WX runtime will do the conversion implicitely.

I even noticed that the WX runtime takes quiet some of these conversions into account by itself since V20 when you are accessing ANSI based resources from a unicode based configuration.

However, if you have a complex project that uses a lot of external non WX resources, I would not try to create both a unicode and an ansi configuration and thus executables. Stick to a single unicode executable version in that case since it will allow you to not have to do too much specific declarations inside the code where it would be required. If you do it that way, you shouldn't encounter any special attention coding points.

Contrary to Fabrice, I don't think you'll need to go through your UI and change all fields to unicode. At least I never did that and it seems to work.
Also contrary to Fabrice, in the analysis, there is an option to do a bulk update of all strings to unicode. Something I requested as a feature in V17 or V18 to tech support and which was included in V19 if I recall correctly.

You can find this option in: Analysis->Maintenance->Convert the items from Ansi to Unicode

So according to me it's not so much work to do the conversion, and unicode is not only requried if you're doing double-byte character sets like Chinese or Korean but also for any cross-platform WX application including a mobile version...

Just my 2 cents,

Peter Holemans
Ola
Re: [WD21] Using Unicode?
May 27, 2016 12:27PM
Thanks Peter,

I'm sure your 2 cents are worth much more:=)
Indeed, there is an ascii->unicode conversion tool as you pointed out, so thank you for requesting it and thanks to PCSoft for doing it. This makes the work much easier, even more than 10 times faster:=)

Best regards
Ola
Steven Sitas
Re: [WD21] Using Unicode?
May 27, 2016 08:17PM
Hi Ola,
I changed ALL my apps to unicode in v19.
Never ever found any kind of problem, like the ones Fabrice posted.

In versions (previous to 19) there was a problem, when changing OLD apps to unicode.
The problem was ONLY with assignments and ONLY if you used NON Western Ansi.

say you had (in ANSI):
myString is string // this is a ansi string
myString="xxxxx"

When changing to unicode:
myString is string // this is NOW automatically a unicode string
myString="fhgvh" // this is NOW "messed up" if you where using NON Western Ansi.
Since ALL UI descriptions, captions etc where translated AUTOMATICALLY to Unicode (even on NON Western Ansi), there wasn't any reason for the problem in assignments. Seems like PCSoft just forgot them, but they are fixed in v19 and later.

Other than the above issue (in pre v19), I haven't seen ANY kind of problem.
And everything works like a charm accross ALL WX products.

Steven Sitas
ccc2
Re: [WD21] Using Unicode?
May 28, 2016 06:20PM
Hi Ola,

you don't need worry about unicode if you in windows ( windows will do auto convert) . but once you in android/linux , things become pain because UTF-8 is more common and there is no auto convert.
Ola
Re: [WD21] Using Unicode?
May 30, 2016 10:12PM
Hi Steven and ccc2 &all

Thank you for sharing your experience. I think I'll do it after all.

Best regards
Ola
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: