[WD20] UTF-8 charset on MySQL in analysis

Startbeitrag von Patrick Thijs am 18.09.2015 21:56

Hello,

does anyone knows how to define a MySQL table in the Windev Analysis that is Unicode, using the utf-8 charset ?

Or do I need to do it in (SQL)code ? and if so, how can I use that table in my program if it's not defined in the analysis ?


grtz

Patrick

Antworten:

Hi Pattrick

in windows you no need to worry about that
"Unicode-enabled functions in Windows use UTF-16, it is also possible to work with data encoded in UTF-8 or UTF-7, which are supported in Windows as multibyte character set code pages."

but if you really need to use specific character-set, then try this function

http://doc.windev.com/en-US/?3054001&name=changecharset_function

von CCC2 - am 20.09.2015 21:13
try change character set in project description -> language ->various tab

von CCC2 - am 21.09.2015 07:42
I think I've explained my problem wrong.

When I define a MySQL table in the Windev Analysis, and I check it in a took like Navicat for example, I can see this for the DDL :

CREATE TABLE `XTrackGenre` (
`TrackGenreID` int(11) NOT NULL auto_increment,
`TrackID` int(11) default NULL,
`GenreID` int(11) default NULL,
`SubGenreID` int(11) default NULL,
PRIMARY KEY (`TrackGenreID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

the problem is the CHARSET of the Table, this needs to be UTF-8, but I can't find a way to define this in the analysis.
And I really need this, because my tables will contain Unicode characters

grtz

Patrick

von Patrick Thijs - am 21.09.2015 17:09
Hi Patrick,

now I'm confused...

Why would you want a unicode charset in a table/file containing only INTs like the one you just declared?

And what happens if you declare at least ONE string field, and in the options, you set that field as unicode?

Best regards

von Fabrice Harari - am 21.09.2015 20:18
Hello Fabrice,

the DDL-statements that I was showing are just as an example, the DDL-code for the real tables is a lot bigger, so I pasted the code of a small table, that doesn't need UTF-8

At least someone is awake :)

von Patrick Thijs - am 21.09.2015 20:27
yep... but it doesn't answer my question...

what happens for a table where you define a field as UNICODE string?

Best regards

von Fabrice Harari - am 21.09.2015 20:53
Hello Fabrice,

I've created a new table in the analysis, named "test", and it has two fields, the autonumbered field, and a textfield, wich I have set to unicode.
Languageparameters for this field are English - USA - Standard

I've compiled my program, and try to let it create the table on the MySQL server, and then I get this error :

native MySQL access error.
Error Number = 22

The following error was returned by the database:
Error number = .
Error message:
Unknown character set: 'ucs2'

So, the one-million-dollar-question now is : how can I make this work, with UTF-8 character-set

grtz

Patrick

von Patrick Thijs - am 21.09.2015 21:01
I've did the test with a normal text-field in stead of a unicode text-field, and then I don't have any error, but the charset of my table is Latin-1 then :(

-- Table "test" DDL

CREATE TABLE `test` (
`testID` bigint(20) NOT NULL auto_increment,
`test` varchar(50) default NULL,
PRIMARY KEY (`testID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

von Patrick Thijs - am 21.09.2015 21:25
Hello again,

two questions:

- are you using the native access or oledb/odbc?

- did you try the contrary: create the table in mysql, then import it's definition in the analysis?

Best regards

von Fabrice Harari - am 22.09.2015 09:28
Hello Fabrice,

I'm using Native Access to the MySQL database.

I followed your advice, and made a simple two field table in MySQL with Navicat.
Then I imported it into my analysis and deleted the original table from the mysql-server.
When I try to create the table from within my program, I get this error :

native MySQL access error.
Error Number = 22

The following error was returned by the database:
Error number = .
Error message:
Unknown character set: 'ucs2'

and no table is created....

I've sent a support request to PCSoft yesterday-evening about this error, but until now, no response....

von Patrick Thijs - am 22.09.2015 15:07
In the mean time I have contacted PCS support, and we found the cause of my problems.
The version of the MySQL server we are using is to low....

To test things at home (because upgrading the MySQL is something that can't be done right now) I've installed a MariaDB on my NAS.
And here things work without error.
I just need to find out what language settings I need to get fields with UTF-8 Charset

von Patrick Thijs - am 24.09.2015 17:11
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.