Bonjour,

Comment peut-on convertir de UTF-32 vers UTF-16?

exemple:
Hex/UTF-32 --------------------------- Decimal --------------------------- UTF-8 --------------------------- UTF-16

1F605 ---------------------------------- 128517 --------------------------- F0 9F 98 85 -------------------- D83D DE05

Comment obtenir le résultat (D83D DE05) à partir de (1F605)


J'ai trouver cette procédure mais je sais pas comment la traduire vers WL

Code C : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
unsigned int convertUTF32ToUTF16(unsigned int cUTF32, unsigned int &h, unsigned int &l)
{
    if (cUTF32 < 0x10000)
    {
        h = 0;
        l = cUTF32;
        return cUTF32;
    }
    unsigned int t = cUTF32 - 0x10000;
    h = (((t<<12)>>22) + 0xD800);
    l = (((t<<22)>>22) + 0xDC00);
    unsigned int ret = ((h<<16) | ( l & 0x0000FFFF));
    return ret;
}


Merci pour votre aide