• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Fixed GLFW: SetClipboard and special characters

Pierrou

Well-known member
Joined
Jul 6, 2017
Messages
237
Hi,
I intended to use SetClipboard to export French sentences from my current game to the clipboard and it turns out it doesn't seem to manage special characters such as diacritics.
à é ô and so on become � � �

Is there an easy way to copy special characters to the clipboard too?
{Edit : no big deal if that's not the case}
Thanks!
 
Last edited:
Mmh, on desktop it uses the buildin GLFW functionalities. Which platform?
 
Ok, have to look into this. It is a unicode problem. Not sure if our version of GLFW is supporting that. I will report back when I know more.
 
Again, If I'm the only one needing this, no need to worry I have a plan B, thanks!!
 
Well, these little things are always worth investigating. Maybe you can open an issue on github!? So it doesn't get lost.
 
Ok, have to look into this. It is a unicode problem. Not sure if our version of GLFW is supporting that. I will report back when I know more.
As far as I know GLFW 3.0+ supports uni-code utf8 text. All encoding is utf8 const char*. Probably need to use the standard C mbstowcs or one of it's sister functions to convert Cerberus strings.

Here's a little bit of code that I use to get information back from stdout and stderr. I'm sure that it will come in useful some where.
It will probably need a code guard to stop is being included multiple times.

C++:
// Windows, Linux, OSX dirty conversion from multi-byte to wchar
String MBTOWC(const char* ptr, size_t bytes){
    String result;
    int len;
    wchar_t dest;
    mbtowc (NULL, NULL, 0);
    while (bytes>0) {
        len = mbtowc(&dest,ptr,bytes);
        if (len<1) break;
        result+=String(dest,1);
        ptr+=len;
        bytes-=len;
    }
    return result;
}

/*
    Add the abillity to pipe child process output.
    Note that for MS Windows only console mode applications are supported at this time and hasn't been tested yet
    cmd = the full command line to execute.
    ref = the string to receive stdout and stderr.
    returns an integer exit code. 
*/
int ExecutePipe( String cmd, String &ref ){
    FILE* filestream;
    char streambuffer[4096];
    int exitcode=-1;
    #ifdef _WIN32
    filestream=_popen(String(cmd+" 2>&1").ToCString<char>(), "r");
    #else
    filestream=popen(String(cmd+" 2>&1").ToCString<char>(), "r");
    #endif
    if(filestream==NULL ||cmd==""){
        ref=String("Invalid child process.\n");
        #ifdef _WIN32
        _pclose(filestream);
        #else
        pclose(filestream);
        #endif
        return exitcode;
        }
    while(fgets(streambuffer,sizeof(streambuffer), filestream) !=NULL){
        ref+=MBTOWC(streambuffer,sizeof(streambuffer));
    }
    #ifdef _WIN32
    return _pclose(filestream);
    #else
    return pclose(filestream);
    #endif
}
 
Last edited:
Back
Top Bottom