Monday, 23 April 2007

Applying LEFT to UTF-8 string in MySQL 3

While applying LEFT function (MySQL built-in or Parser's) to the data encoded in UTF-8 in MySQL 3 database, you could get an charset dismatch error.

One chap at TeleType studio had written a quick workaround. This function chops the string by the first preceding space:


@subString[content;length]
$length(^length.int(0))
^while(^content.mid($length;1) ne ' ' && $i<^content.length[]){
^length.dec(1)
}
$result[^content.left($length)]
#/subString

No comments: