[Encoding with Lasso 8 and MySQL 4]
Jess Mooers, February 08, 2006
Symptoms of an Encoding Issue
If you are using Lasso 8.1 and MySQL 4.1.x and certain characters show as boxes, question marks, or are simply missing when viewed with a web browser, the encoding is not set correctly at one or various levels of setup.
This procedure is designed to address issues that occur when dealing with special characters (e.g. curly quotes, bullets, TradeMark, dashes, arrows, MS Word copy-and-pasted text). It assumes you have a .sql file to create a MySQL database. This proceedure will show you the necessary steps in Lasso 8.1, MySQL 4.1.x and page head tags to have default UTF-8 encoding display in the browser.
1. Navicat/MySQL 4.1.x Database Setup
1a. Create a new Database
Make sure "Default Character Set" is UTF8.
Default Collation should be set to nothing.
1b. Import .sql file to Create table and import data
1b1. Make sure that the .sql file does not have any Latin1 encodings for the fields.
THIS IS AN EXAMPLE OF A .SQL FILE WITH BAD TABLE CREATE STATEMENT
CREATE TABLE `custom_tag_v1` (
`id` int(11) NOT NULL auto_increment,
`description` character set latin1 varchar(255) NOT NULL default '',
`original_char` character set latin1 varchar(10) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
THIS IS AN EXAMPLE OF A .SQL FILE WITH GOOD TABLE CREATE STATEMENT
CREATE TABLE `custom_tag_v1` (
`id` int(11) NOT NULL auto_increment,
`description` varchar(255) NOT NULL default '',
`original_char` varchar(10) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
1b2. Import the .sql file with File Encoding of "Unicode (UTF-8)".
2. Lasso Admin Settings
2a. Setup: Data Sources: Hosts
When you create a host you have to have "Use MySQL 4.1 Character Sets" set to Yes.
* Important Note: Simply changing a Host from no to yes will not fix the encoding.
If the host is set to no for this setting you will have to delete the host and re-create it.
2b. Setup: Data Sources: Tables
Table Detail for the each individual table needs to be set to "UTF-8 (Unicode)"
The default is Latin-1, and it must be changed for every table that uses Lasso code.
You can use Table Batch change (from the Setup: Data Sources: Hosts page) if you would like.
2c. Setup: Site: Settings
Set the Default Page Encoding to "UTF-8 (Unicode)"
3. Code
3a. HTML code in Lasso files
3a1. Make sure the following code is between the <head></head> tags of each lasso page.
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
3a2. Remove any code that calls for Latin-1, Windows-1252 or ISO-8859-1 charsets
An example would be the following line of code
[content_type: 'text/html;
charset=ISO-8859-1']