Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 214927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:25:16+00:00 2026-05-11T18:25:16+00:00

I am having utf-8 encoded file containing arabic text and I have to search

  • 0

I am having utf-8 encoded file containing arabic text and I have to search it.

My problem are diacritics, how to search skipping them?

Like if you load that text in Internet Explorer (converting text in HTML ofcourse ), IE is skipping those diacritics?

Any help?

Edit1: Search is simply performed by following code:

 var m1 : TMemo; //contains utf-8 data)
     m2 : TMemo; // contains results

 ...

      m2.lines.BeginUpdate;
      for s in m1.Lines do
      begin
        if pos(eSearch.Text,s)>0 then
           begin
           m2.Lines.Add(s);
           end;
      end;
      m2.Lines.EndUpdate;

Edit2: Example of unicode data:

قُلْ هُوَ اللَّهُ أَحَدٌ
If you search only letters without diacritics قل the word قُلْ wont be found.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:25:17+00:00Added an answer on May 11, 2026 at 6:25 pm

    I find that diacritics are not the only problem.

    I would do character replacements, replacing them by empty strings, I would also normalize the text ‘أ’ ‘إ’ ‘آ’ are all converted to ‘ا’, and also do the same for ى ئ ي ؤ و ة ه …

    For search I’d also use a light stemmer like the “khoja stemmer” (Java source here)

    A more advanced way is to do it like TREC:

    • Remove punctuation
    • Remove diacritics (mainly weak vowels) Most of the corpus did not contain weak vowels.
    • Some of the dictionary entries contained weak vowels. This made everything consistent.
    • Remove non letters
    • Replace initial إ or أ with bare alif .ا
    • Replace آ with ا
    • Replace the sequence ىء with ئ
    • Replace final ى with ي
    • Replace final ة with ه
    • Strip 6 prefixes: definite articles ( فال آال، بال، وال، ال، ) and و
      (and) from the beginnings of normalized words
    • Strip 10 suffixes from the ends of words ات ان، ها،ي ة، ه، ية، يه، ين، ون

    I would index the text by this modified text (for memos I’d store the index of the word in the original text), and do the same thing for the search query.

    I would also search in Memo1.Text and not the lines one by one, the search could be for multiple words that may be at the end of a line and wrapped to the next line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having troubles with reading a UTF-8 encoded text file in Hebrew. I read
I am having no problem converting a string to a byteArray of UTF-16 encoded
I'm loading a UTF-8 encoded text file into an array. At several places in
Having an utf-8 encoded string like this: bar = hello 。◕‿‿◕。 and a bytes
Having used storyboards for a while now I have found them extremely useful however,
I am having a HTML site declared and encoded as UTF-8. My Javascript sources
I'm having some problem getting text with special characters (Swedish: åäö) from the database.
In DOS batch, I have to read file paths from a file encoded in
I'm having a problem with some characters like 'í' or 'ñ' working in a
I'm having some brain failure in understanding reading and writing text to a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.