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 7864411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:46:53+00:00 2026-06-02T23:46:53+00:00

I’d like to iterate through Unicode characters, gobbling up all combining characters that follow

  • 0

I’d like to iterate through Unicode characters, gobbling up all combining characters that follow the initial code point.

This is what I have so far, but it acts really weird for some random Unicode sequences I tried: (for example, when I pass it things like “a̔” (U+0061 LATIN SMALL LETTER A followed by U+0314 COMBINING REVERSED COMMA ABOVE) it sees it as two characters rather than one. Other things, like “e︠” (U+0065 LATIN SMALL LETTER E followed by U+FE20 COMBINING LIGATURE LEFT HALF) are seen as one character)

int COMBINING[] = {
    0x0300, 0x036F,
    0x1DC0, 0x1DFF,
    0x20D0, 0x20FF,
    0xFE20, 0xFE2F,
    0 //sentinel
};

utf8_index_t ut_nextchar(utf8_t source, utf8_index_t curr)
{
    int c = decode_cp(source, &curr);
    int comb = 0;
    if (c == 0)
        return -1;
    while (COMBINING[comb] != 0)
    {
        for (comb = 0; COMBINING[comb] != 0; comb += 2)
        {
            if (c >= COMBINING[comb] && c <= COMBINING[comb + 1])
            {
                c = decode_cp(source, &curr);
                if (c == 0)
                    return -1;
                break;
            }
        }
    }
    return curr;
}
  • 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-06-02T23:46:54+00:00Added an answer on June 2, 2026 at 11:46 pm

    Actually, Unicode characters are mostly 1:1 to Unicode codepoints – what you’re interested in are Unicode grapheme clusters, which correspond to so-called user-perceived characters.

    You can find my implementation of the algorithm, including property data, here at bitbucket.

    If you’re not interested in the full algorithm, you can use

    gc_break_property(c) == GC_BP_Extend
    

    to check for characters with property Grapheme_Extend and

    gc_break_property(c) & GC_FLAG_POSTFIX
    

    if you want to include spacing marks as well.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I would like to count the length of a string with PHP. The string

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.