Solved

SQL convert diacritic to anglicized form

Posted on 2011-09-20
6
1,027 Views
Last Modified: 2012-05-12
Hello All,

We need to convert diacritic supplied by the front end to anglicized form to search

For example:

(ÀÖÙãas) to (AOUaas), because the database column we have does not contain diaciritc, so we if user added a diacritic character we need to search with non diacritic form.

Please help

Thank you
0
Comment
Question by:dojjol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 15

Expert Comment

by:x77
ID: 36567870

  S has 6 chars.
  Normalized string has 10 chars. Each diacritic char is decomposed.

  I added all chars from s1 to Sb except NonSpacingMark chars.
Dim s = "ÀÖÙãas"
     Dim s1 = s.Normalize(NormalizationForm.FormD)
     Dim sb As New StringBuilder(s.Length)
     For Each c In s1
         If Char.GetUnicodeCategory(c) = Globalization.UnicodeCategory.NonSpacingMark Then Continue For
         sb.Append(c)
     Next
     Debug.Print(sb.ToString)

Open in new window

0
 

Author Comment

by:dojjol
ID: 36567906
thank x77, is it a stored procedure?
0
 
LVL 15

Expert Comment

by:x77
ID: 36567932
Sorry.

SELECT CONVERT('Ä Ê Í Õ Ø A B C D E','US7ASCII','WE8ISO8859P1')
FROM DUAL;
A E I ? ? A B C D E

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:x77
ID: 36567951
SELECT CONVERT('ÀÖÙãas','US7ASCII') FROM DUAL;    ->AOU?as
0
 

Author Comment

by:dojjol
ID: 36568308
thanks again, but we missed 'Ù' and is replaced as '?' in AOU?as, so not really sure this will work for me
0
 
LVL 15

Accepted Solution

by:
x77 earned 500 total points
ID: 36568574
Yes, I see on my machine that "Õ" Translates to ?, But I am work with Spanish.

You can try a char_set_from that contains this leter.
http://www.techonthenet.com/oracle/functions/convert.php

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question