Skip to content

Instantly share code, notes, and snippets.

View nicolapetracchi's full-sized avatar

Nicola nicolapetracchi

View GitHub Profile
@joni
joni / maybe_utf8_decode.sql
Created August 2, 2012 11:20
maybe_utf8_decode: MySQL function to recover doubly UTF-8 encoded text
DELIMITER $$
CREATE FUNCTION maybe_utf8_decode(str text charset utf8)
RETURNS text CHARSET utf8 DETERMINISTIC
BEGIN
declare str_converted text charset utf8;
declare max_error_count int default @@max_error_count;
set @@max_error_count = 0;
set str_converted = convert(binary convert(str using latin1) using utf8);
set @@max_error_count = max_error_count;
@fabeat
fabeat / README
Created May 4, 2010 11:02
MYSQL SLUG FIX (Unique fix)
MYSQL SLUG FIX
The table 'content' contains pages with a slug. This slug should be unique but it isn't.
unique_fix.sql fixes this problem and makes the slug-column unique.