Skip to content

Arturo console input handles only lower Unicode range chars on Windows #2212

@Oldes

Description

@Oldes

When one paste into console content like: "中" or some funny emoticons like: "👨‍👩‍👧", the output in the console is broken:

Image

Problem is at this line:

return k->uChar.UnicodeChar;

If the char is a high surrogate, you keep it, read the lower surrogate and combine these before returning... something like this:

				if (wc >= 0xD800 && wc <= 0xDBFF) {
					surrogate_high = wc;
					continue; // keep reading a key
				}
				if (wc >= 0xDC00 && wc <= 0xDFFF) {
					if (surrogate_high == 0) continue;  // orphan low - discard
					req->key.uchar = 0x10000
						+ (((REBU32)(surrogate_high - 0xD800)) << 10) + ((REBU32)(wc - 0xDC00));
					surrogate_high = 0;
				}
				else {
					req->key.uchar = wc; // normal Unicode char
				}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions