Here is a parsing function:
double transform_units(double val, const char* s)
{
cout << s[0];
if (s[0] == 'm') return val * 1e-3;
else if (s[0] == 'µ') return val * 1e-6;
else if (s[0] == 'n') return val * 1e-9;
else if (s[0] == 'p') return val * 1e-12;
else return val;
}
In the line with 'µ' I'm getting the warning:
warning: multi-character character constant [-Wmultichar]
and the character 'µ' is not being catched.
How to compare multibyte characters?
Edit: a dirty workaround is to check if it is less than zero. As Giacomo mentioned, it's 0xCE 0xBC, both these bytes are greater than 127, so less than zero. It works for me.