0

I have two unrelated but very similar problems with JQuery Mobile's listview.

One listview is a filter reveal with local data. The problem is, if the item is named "estación", it will only show up when typing "estació", but not "estacio". I.e. what I would like to do is an accent insensitive listview filter.

The other problem involves another listview, this time it's a remote autocomplete like the one here. In this case, it's the opposite: if I type "estacio" I do get "estación", but if I type "estació" I don't get anything. I think this might be a problem with encoding, as I get 'é' in my controller instead of "é". I tried putting

dataType : "application/json;charset=UTF-8",
encoding : "utf-8"

in my javascript code but it still does not work.

For the record, this is the line that makes the AJAX call:

                        xhr = $.ajax({
                            url : urlBase + "mycontroller/search",
                            dataType : "application/json;charset=UTF-8",
                            crossDomain : true,
                            encoding : "utf-8",
                            data : {
                                q : $input.val()
                            }
                        });

I put a breakpoint on the input.val() and at that point the value was still "é". Yet when it hits my controller, it's 'é'.

MichelReap
  • 5,630
  • 11
  • 37
  • 99
  • The file itself has to be UTF-8 encoded when saved. As for the other search, you'd need to normalize replacements before searching. –  Jan 13 '14 at 12:56
  • both of my files (the jsp and the js used within) are utf-8 – MichelReap Jan 13 '14 at 12:58
  • What about where the mal-formed data is coming from? If it's a file, then *that* file needs to be UTF-8... a DB, then the table structure needs to be that way. –  Jan 13 '14 at 12:59
  • I've edited my answer with the AJAX call. When the call reaches my controller, the special character is already malformed. It hasn't still reached the database, so it can't be a problem with that. – MichelReap Jan 13 '14 at 13:02
  • OH! I thought you were talking about data returned from the server, not the data being sent to the server. Is there a live demo somewhere? –  Jan 13 '14 at 13:03
  • Unfortunately, there isn't yet – MichelReap Jan 13 '14 at 14:05
  • I'd have to see it working to see what all is being executed and determine any help I can provide. –  Jan 13 '14 at 14:06
  • Sadly I cannot upload it, I don't have any java application servers up. But I've discovered that accesing the url directly via the browser it causes the same problem, so Im guessing the issue is related to Spring more than to the client javascript side. – MichelReap Jan 13 '14 at 16:13

0 Answers0