Search with accents in SQL Yoga
Moderators: FourthWorld, heatherlaine, Klaus, robinmiller, trevordevore
Search with accents in SQL Yoga
Hi all,
I'm trying out the French Regions demo and trying to find cities with an accent can not find them.Is there any way to do it?
Thanks in advance,
Carles
I'm trying out the French Regions demo and trying to find cities with an accent can not find them.Is there any way to do it?
Thanks in advance,
Carles
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Search with accents in SQL Yoga
Hi Carles - searching for accented characters can work. There is most likely a text encoding issue. Which version of LC are you using and which string are you searching for?
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Re: Search with accents in SQL Yoga
Hi Trevor,
LC 9.0.0, MacOX 10.13.6 Spanish version.
Some of the cities I've tried, they're all in the database and the accents look good: Belvédère, Orgnac-sur-Vézère, Castellet-lès-Sausses, Abergement-Clémenciat, Ambléon.
Regards,
Carles
LC 9.0.0, MacOX 10.13.6 Spanish version.
Some of the cities I've tried, they're all in the database and the accents look good: Belvédère, Orgnac-sur-Vézère, Castellet-lès-Sausses, Abergement-Clémenciat, Ambléon.
Regards,
Carles
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Search with accents in SQL Yoga
I took a look at the code and here is what I found out. The sample stack uses the text of the search field when generating the query. In LC 9 this will encode an é as unicode. SQLite is expecting a UTF-8 string so you need to make the change accordingly.
1. edit script of group "TownsGroup"
2. Change line 66 to this:
I get a search result when searching for Ambléon after making that change.
1. edit script of group "TownsGroup"
2. Change line 66 to this:
Code: Select all
sqlyoga_splitUserSearchString(textencode(the text of field "SearchName", "utf8"))
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Re: Search with accents in SQL Yoga
Thank you very much Trevor,
Works correctly. If I save text with accents I'll have to change texencode with texdecodee?
Works correctly. If I save text with accents I'll have to change texencode with texdecodee?
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
Re: Search with accents in SQL Yoga
You always need to ensure that you match the encoding used in LiveCode to the encoding used in the database. When storing data in a UTF-8 column you need to encode it as UTF-8 before passing it to SQL Yoga. I like to work in LC's native encoding when working with data within LC. I then convert to UTF-8 when inserting, updating, or searching the database.
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder