Live data from Hacker News

Show HN: Mojibake – A low-level Unicode library written in C

mojibake.zaerl.com

21–25 of 25 posts

Re: Show HN: Mojibake – A low-level Unicode library written in C

#21
post #18

Earlier quoted context omitted.

(Author here) Dealing with encodings is already a big step when you aim to handle multiple ones and multiple OSes. You can see what I am talking about in the tests/ folder. With Mojibake, I wanted to help people handle text by providing the smallest possible C/C++ library, without requiring them to use a +20MB library just to normalize a string, handle a flag emoji, or perform similar tasks. See the CONFORMANCE_REQUI…

Don't take my comment as dismissive of your project. The people using it will probably have an easier time navigating Unicode text than they would have if they had used other existing libraries or tried to roll their own. It's more a comment on the users who need to be warned that "no, you probably don't want your C program to know if that string actually fits in the 80 column terminal".

Keep in mind that I appreciated your comment. My library has a very narrow target

There is an MJB_FEATURE_CHARACTER_NAMES option you can set to zero if you don't want to have a function that returns the name of a codepoint, such as "LATIN SMALL LETTER E WITH ACUTE". This is something that probably most people do not need at all. This shrinks "Hello World" macOS ARM executable from 937KB to 663KB.

I should probably offer other runtime options so users can literally strip away everything they don't need. For example, as you suggested, measuring whether a string is less than 80 columns is something you don't do every day.

Re: Show HN: Mojibake – A low-level Unicode library written in C

#22
post #19
post #3

I have come to the conclusion that the only Unicode support needed in C is supporting pointers to char and arrays but lightweight C libraries are always welcome.

So how do you uppercase or lowercase an arbitrary character? How do you check if it's a valid character? How do you deal with combining characters? Most of the world don't use just the Latin subset in ASCII or follow the same assumptions about letters, words, cases etc etc.

That's the trick.

You don't.

Re: Show HN: Mojibake – A low-level Unicode library written in C

#23
post #19

Earlier quoted context omitted.

So how do you uppercase or lowercase an arbitrary character? How do you check if it's a valid character? How do you deal with combining characters? Most of the world don't use just the Latin subset in ASCII or follow the same assumptions about letters, words, cases etc etc.

That's the trick. You don't.

So you solution to dealing with X is 'dont deal with x'?
Post reply on HN