Closed dogunter closed 8 years ago
This is a unicode character. You can substitute it by its html code "ø"
Geoff, I solved this problem for any utf-8 character by doing "mysqli_query("SET NAMES 'utf8'");" before text queries.
On Aug 16, 2016, at 00:20, David Gunter notifications@github.com wrote:
Just installed BCOE 2.1.4 on a server and during setup I received this error message:
Incorrect string value: '\xF8gne \xF8...' for column 'brewStyleComEx' at row 1
Using Apache2, php 5.6, and mysql 5.7.12.
Thanks, david
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks Ricardo for taking this one. Upon further thought and research, I'm thinking that adding the following line of code in the config.php file will achieve the same goal of encoding in utf-8 for all MySQL queries...
mysqli_set_charset($connection,'utf8');
Place it after the $connection
variable:
$connection = new mysqli($hostname, $username, $password, $database);
mysqli_set_charset($connection,'utf8');
I have not tested inserting data with non-latin characters as of this writing, so if you do implement it, please post back any comments or issues.
I tried Geoff's suggestion and placed the line right after the $connection line in config.php but received the same error. The tables start to populate but the styles table always errors out on entry #40, the one containing the oslash character.
I then tried to put "mysqli_query("SET NAMES 'utf8'");" before all the $result = mysqli_query() lines in /setup/install_db.setup.php, but this also didn't work.
For now I just have to change the text in the install_db.setup.php file to not contain any utf8 characters.
-david
On Tue, Aug 16, 2016 at 8:31 AM, geoffhumphrey notifications@github.com wrote:
Thanks Ricardo for taking this one. Upon further thought and research, I'm thinking that adding the following line of code in the config.php file will achieve the same goal of encoding in utf-8 for all MySQL queries...
mysqli_set_charset($connection,'utf8');
Place it after the $connection variable:
$connection = new mysqli($hostname, $username, $password, $database); mysqli_set_charset($connection,'utf8');
I have not tested inserting data with non-latin characters as of this writing, so if you do implement it, please post back any comments or issues.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffhumphrey/brewcompetitiononlineentry/issues/663#issuecomment-240119861, or mute the thread https://github.com/notifications/unsubscribe-auth/AARoS2Y81AVhPoxFAKFYaVosTeAxLmtGks5qgcmkgaJpZM4Jk_rP .
David Gunter Santa Fe, NM
I am replacing all the foreign characters in setup/install_db.setup.php with the html codes and saw this for the styles table entry #71. The setup errors out when it encounters the bracketed <96> just before the text "Michael Jackson". Can you tell me what that <96> is supposed to be doing?
-david
$updateSQL .= "(71, 'A', 'Old Ale', 'Strong Ale', '1.06', '1.09', '1.015', '1.022', '6', '9', '30', '60', '10', '22', 'Ale', 'An ale of significant alcoholic strength, bigger than strong bitters and brown porters, though usually not as strong or rich as barleywine. Usually tilted toward a sweeter, maltier balance. “It should be a warming beer of the type that is best drunk in half pints by a warm fire on a cold winter’s night” <96> Michael Jackson.', ' http://www.bjcp.org/2008styles/style19.php#1a', '19', 'Y', 'bcoe', 'BJCP2008', 0, 0, 0, 0, '', 'Gale’s Prize Old Ale, Burton Bridge Olde Expensive, Marston Owd Roger, Greene King Olde Suffolk Ale , J.W. Lees Moonraker, Harviestoun Old Engine Oil, Fuller’s Vintage Ale, Harvey’s Elizabethan Ale, Theakston Old Peculier (peculiar at OG 1.057), Young’s Winter Warmer, Sarah Hughes Dark Ruby Mild, Samuel Smith’s Winter Welcome, Fuller’s 1845, Fuller’s Old Winter Ale, Great Divide Hibernation Ale, Founders Curmudgeon, Cooperstown Pride of Milford Special Ale, Coniston Old Man Ale, Avery Old Jubilation.', ''), ";
On Tue, Aug 16, 2016 at 12:39 PM, David Gunter dogunter@gmail.com wrote:
I tried Geoff's suggestion and placed the line right after the $connection line in config.php but received the same error. The tables start to populate but the styles table always errors out on entry #40, the one containing the oslash character.
I then tried to put "mysqli_query("SET NAMES 'utf8'");" before all the $result = mysqli_query() lines in /setup/install_db.setup.php, but this also didn't work.
For now I just have to change the text in the install_db.setup.php file to not contain any utf8 characters.
-david
On Tue, Aug 16, 2016 at 8:31 AM, geoffhumphrey notifications@github.com wrote:
Thanks Ricardo for taking this one. Upon further thought and research, I'm thinking that adding the following line of code in the config.php file will achieve the same goal of encoding in utf-8 for all MySQL queries...
mysqli_set_charset($connection,'utf8');
Place it after the $connection variable:
$connection = new mysqli($hostname, $username, $password, $database); mysqli_set_charset($connection,'utf8');
I have not tested inserting data with non-latin characters as of this writing, so if you do implement it, please post back any comments or issues.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffhumphrey/brewcompetitiononlineentry/issues/663#issuecomment-240119861, or mute the thread https://github.com/notifications/unsubscribe-auth/AARoS2Y81AVhPoxFAKFYaVosTeAxLmtGks5qgcmkgaJpZM4Jk_rP .
David Gunter Santa Fe, NM
David Gunter Santa Fe, NM
Looks like that is a n-dash character before Michael Jackson...
Thanks, Geoff, I will be away the next few days but I can give it a try next week. It is certainly better to do that just at the config.php file.
I did try using mysqli_query('SET character_set_connection=utf8') (along with ..._set_client and ..._set_results), but for some reason which I don't remember I changed to mysql_query("SET NAMES 'utf8'"). Hope this one will work.
On Aug 16, 2016, at 11:31 AM, geoffhumphrey notifications@github.com wrote:
Thanks Ricardo for taking this one. Upon further thought and research, I'm thinking that adding the following line of code in the config.php file will achieve the same goal of encoding in utf-8 for all MySQL queries...
mysqli_set_charset($connection,'utf8');
Place it after the $connection variable:
$connection = new mysqli($hostname, $username, $password, $database); mysqli_set_charset($connection,'utf8');
I have not tested inserting data with non-latin characters as of this writing, so if you do implement it, please post back any comments or issues.
� You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
I tried "mysqli_set_charset($connection,'utf8');" in config.php but unfortunately it did not work.
Maybe this in config.php will work. I'm thinking it will since this code is loaded before every DB query.
$connection = new mysqli($hostname, $username, $password, $database);
mysqli_set_charset($connection,'utf8');
mysqli_query($connection, "SET NAMES 'utf8';");
mysqli_query($connection, "SET CHARACTER SET 'utf8';");
mysqli_query($connection, "SET COLLATION_CONNECTION = 'utf8_unicode_ci';");
When I was getting these utf8 errors I was doing all the web work on an OSX El Capitan system. I've since moved to a linux system but with similar apache2 versions, mysql, and PHP. The code works correctly here, so I suspect there is an issue with OSX. Even add the extra lines mysqli_set_charset($connection,'utf8');
mysqli_query($connection, "SET NAMES 'utf8';"); mysqli_query($connection, "SET CHARACTER SET 'utf8';"); mysqli_query($connection, "SET COLLATION_CONNECTION = 'utf8_unicode_ci';");
had no effect.
-david
On Wed, Aug 17, 2016 at 12:44 PM, geoffhumphrey notifications@github.com wrote:
Maybe this in config.php will work. I'm thinking it will since this code is loaded before every DB query.
$connection = new mysqli($hostname, $username, $password, $database); mysqli_set_charset($connection,'utf8'); mysqli_query($connection, "SET NAMES 'utf8';"); mysqli_query($connection, "SET CHARACTER SET 'utf8';"); mysqli_query($connection, "SET COLLATION_CONNECTION = 'utf8_unicode_ci';");
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffhumphrey/brewcompetitiononlineentry/issues/663#issuecomment-240508078, or mute the thread https://github.com/notifications/unsubscribe-auth/AARoS1Gd-t3m2rDOgmJuosrwtjVQOXoeks5qg1ZygaJpZM4Jk_rP .
David Gunter Santa Fe, NM
I've given up on trying to use the native OSX "El Capitan" apache2 as well as the macports version.
After installing XAMPP and getting it setup, BCOE&M installs without any errors. I don't think this is a bug any longer.
-david
On Fri, Aug 19, 2016 at 4:25 PM, David Gunter dogunter@gmail.com wrote:
When I was getting these utf8 errors I was doing all the web work on an OSX El Capitan system. I've since moved to a linux system but with similar apache2 versions, mysql, and PHP. The code works correctly here, so I suspect there is an issue with OSX. Even add the extra lines mysqli_set_charset($connection,'utf8');
mysqli_query($connection, "SET NAMES 'utf8';"); mysqli_query($connection, "SET CHARACTER SET 'utf8';"); mysqli_query($connection, "SET COLLATION_CONNECTION = 'utf8_unicode_ci';");
had no effect.
-david
On Wed, Aug 17, 2016 at 12:44 PM, geoffhumphrey notifications@github.com wrote:
Maybe this in config.php will work. I'm thinking it will since this code is loaded before every DB query.
$connection = new mysqli($hostname, $username, $password, $database); mysqli_set_charset($connection,'utf8'); mysqli_query($connection, "SET NAMES 'utf8';"); mysqli_query($connection, "SET CHARACTER SET 'utf8';"); mysqli_query($connection, "SET COLLATION_CONNECTION = 'utf8_unicode_ci';");
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffhumphrey/brewcompetitiononlineentry/issues/663#issuecomment-240508078, or mute the thread https://github.com/notifications/unsubscribe-auth/AARoS1Gd-t3m2rDOgmJuosrwtjVQOXoeks5qg1ZygaJpZM4Jk_rP .
David Gunter Santa Fe, NM
David Gunter Santa Fe, NM
I am using XAMPP in an OSX (still 10.8. 5 "Mountain Lion") and don't have any issue with the installation.
Now, back to the issue with unicode characters, it seems just editing the $html_string in includes/scrubber.inc.php to read
$html_string = array();
does the job. No need to change anything in config.php or add mysqli_query("SET NAMES 'utf8'");" before text queries.
I did that long ago together with the SET NAMES stuff and wasn't sure what made it work.
An effort has begun towards making BCOE&M easily translated into other languages. The next version will have a script that will convert the DB, all tables, and all text fields to UTF8. Therefore, the $html_string
array used to "scrub" text input to HTML special characters will no longer be needed for non-English language characters.
Note that the latest commit has a new folder called "lang" - for this release, all public facing pages (Home, My Account, Info, etc.) have had all (I think) embedded English-language words, phrases, and sentences removed and replaced with PHP variables.
So this...
if ($logged_in) $primary_page_info .= sprintf("<p class='lead'>Welcome %s! <small>View your account information <a href='%s' data-toggle='tooltip' title='See your account details and list of entries'>here</a>.</small></p>",$_SESSION['brewerFirstName'],build_public_url("list","default","default","default",$sef,$base_url));
Becomes this...
if ($logged_in) $primary_page_info .= sprintf("<p class=\"lead\">%s %s <small><a href='%s' data-toggle='tooltip' title='%s'>%s</a></small></p>",$default_page_text_006,$_SESSION['brewerFirstName'],build_public_url("list","default","default","default",$sef,$base_url),$default_page_text_007,$default_page_text_008);
These variables are housed in a single file (in this case, the /lang/en/en.lang.php file). The intent is to house all presentation text into a single file that can be translated into different languages.
This release will only feature the "public" pages. The next release will have all presentation text in the Admin, Update, and Setup functions converted to variables and moved to the /lang/en/en.lang.php file as well.
After the next release, I will put out a call via GitHub and the website for people to translate the en.lang.php file into other languages. As translations are completed, admins will be able to choose the presentation language via Site Preferences.
Excellent!!! This a surely a great effort, but quite nice. Thanks!
I had not noticed this lang folder stuff, but I will take into consideration for the pull request I am about to do for displaying the "best brewer" (Ninkasi type) along with the winners and bos that I had implemented here. I think it is nice and the admin may opt to display it or not.
Just installed BCOE 2.1.4 on a server and during setup I received this error message:
Incorrect string value: '\xF8gne \xF8...' for column 'brewStyleComEx' at row 1
Using Apache2, php 5.6, and mysql 5.7.12.
Thanks, david