Reading UTF-8 from a pipe

This works

std::string l;

// Read lines here
while(std::getline(std::cin, l))
    // Send Unicode string
    emit newLine(QString::fromStdString(l));

This works because \n (newline) is a single byte in UTF-8.

This does not work

char c;

// Read bytes here
    // Send Unicode single character
    emit newChar(QChar(c));

This does not work because an UTF-8 character can be up to 4-byte long. [1]