This is a migrated thread and some comments may be shown as answers.

search with international chars - want to replace them.

5 Answers 154 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
aykut
Top achievements
Rank 1
aykut asked on 13 Jan 2014, 01:09 PM
hello there,

I have a combo which is filled with some text in latin chars. and combo works fine, searches fine in latin keyboards. but when user have lets say turkish keyboard search functionality messes up. in server side I replace these characters so sql queries are fine. but bombo itself cannot find right items, which is natural.

what I nd to do is somehow replace these characters, especially letter "I" with latin equalevent. meaning:

ı -> i
İ -> I


these 2 characters are really pain. I tried to use keypress event events and other samples in forum but all of these events not working for "replacing" character.

any suggestions ?

 

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jan 2014, 04:17 AM
Hi,

Please have a look into the following JavaScript to replace a letter with another on onkeyup event of RadComboBox.

JavaScript:
<script type="text/javascript">
    function Replace(event) {
        var combo = $find("<%=RadComboBox1.ClientID %>");
        var val = combo.get_text();
        var len = (val.length) - 1;
        if (event.keyCode == 76) { //if typed key is l, will replace with i
            var res = val.substring(0, len) + "i";
            combo.set_text(res);
        }
        if (event.keyCode == 73) { //if typed key is i , will replace with l
            var res = val.substring(0, len) + "l";
            combo.set_text(res);
        }
    }
</script>

Thanks,
Shinu.
0
aykut
Top achievements
Rank 1
answered on 14 Jan 2014, 11:45 AM
thanks but :
I think radcombobox searches the drop down list and THEN fires the keyup event. here's what happens:

then ı press i then radcombo finds item " Iodine "   -capital i, US keyboard
when I press ı then it finds nothing but changes ı to i

what I dont understand is international characters are always problem and how programmers deal with it ?
in turkish character set when I press ı or its capital form İ radcombo should search for i it application localization is english, which in my case it is.

I face this problem because my application is pure english by web config:
    <globalization fileEncoding="iso-8859-9" requestEncoding="iso-8859-9" responseEncoding="iso-8859-9" culture="en-US" uiCulture="en"/>

but user keyboard is turkish q or turkish f.

though the solution not working for me, thank you very much.

0
Nencho
Telerik team
answered on 17 Jan 2014, 03:52 PM
Hello aukut,

I have prepared a sample project for you, demonstrating a possible implementation of the desired functionality. Please give it a try at your end, and let us know the results.

Note : dll files are removed from the attachment.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
aykut
Top achievements
Rank 1
answered on 18 Jan 2014, 04:38 PM
yeap, thats what I'm looking for. thank you very  much.

I changed the code as:

            function normalizeCultureSpecificCharacters(text) {
                var s = text.replace("\u0131", "I");
                s = s.replace("\u0130", "I");
                return s;
            }

and its changing all special international chars now. capitals and small caps. great.
0
Bunyamin
Top achievements
Rank 1
answered on 28 Oct 2015, 02:07 PM

i've same problem only for (i AND İ) when radcombobox markfirstmach true,

i've attached animation gif file

<telerik:RadComboBox ID="RadComboBox2"  runat="server"
                     DataSourceID="SqlDataSource1" DataTextField="birimadi" AllowCustomText="true" MarkFirstMatch="true" Height="200"
                     DataValueField="birimid" Width="200px" Culture="tr-TR">​

Tags
ComboBox
Asked by
aykut
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
aykut
Top achievements
Rank 1
Nencho
Telerik team
Bunyamin
Top achievements
Rank 1
Share this question
or