mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 15:26:23 -05:00
6b793211c2
Ok, so it may do odd things if it's not truly utf-8, and when moving up and down lines that have utf-8 the cursor moves oddly (because the byte offset within the line stays constant, rather than the character offset), but with this you can actually open the UTF8 example file and move around it, and at least some of the movement makes sense. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 lines
296 B
C
15 lines
296 B
C
#ifndef UTF8_H
|
|
#define UTF8_H
|
|
|
|
typedef unsigned int unicode_t;
|
|
|
|
unsigned utf8_to_unicode(char *line, unsigned index, unsigned len, unicode_t *res);
|
|
unsigned unicode_to_utf8(unsigned int c, char *utf8);
|
|
|
|
static inline int is_beginning_utf8(unsigned char c)
|
|
{
|
|
return (c & 0xc0) != 0x80;
|
|
}
|
|
|
|
#endif
|