Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 2 Monaten
Letzter Beitrag:
vor 1 Jahr, 2 Monaten
Beteiligte Autoren:
Ola, ccc2, Steven Sitas, Peter Holemans, Fabrice Harari

[WD21] Using Unicode?

Startbeitrag von Ola am 26.05.2016 15:26

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


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

von Fabrice Harari - am 26.05.2016 18:04
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

von Ola - am 26.05.2016 20:00
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

von Peter Holemans - am 27.05.2016 07:43
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

von Ola - am 27.05.2016 10:27
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

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

von Steven Sitas - am 27.05.2016 18:17
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.

von ccc2 - am 28.05.2016 16:20
Hi Steven and ccc2 &all

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

Best regards

von Ola - am 30.05.2016 20:12
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.