Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    December 2009
    Location
    Taiwan
    Posts
    313

    Angry Unicode workaround?

    Seriously, being a programmer myself, I'm limited to ANSI characters.

    Yes, yes, I know the devs said that they support Unicode. True, true, the output itself does, the complier itself does, but the actual coding does NOT.

    Unless I'm mistaken, can someone show me a proper way of outputting a string like "我愛你" in a C++ or c with char without having the need to convert each characters into 3 bytes char hex code?

    No, tried string, it still convert into ANSI, tried saving the code in UTF-8, not helping either. None of the method works

    And what's even better is that, even all that's done, one can finally output unicode characters on the chat window, but they still do not work under functions like "author", "descriptions".

    So how am I able to type up how to use some of the functions?

    Seriously, I'm in desperate need for help here.

  2. #2
    Join Date
    December 2009
    Location
    Germany
    Posts
    2,360
    My C++ skills are limited, but if I remember correctly, you must use wchar or wstring as datatypes.

  3. #3
    Join Date
    December 2009
    Location
    Taiwan
    Posts
    313
    Quote Originally Posted by Stefan1200 View Post
    My C++ skills are limited, but if I remember correctly, you must use wchar or wstring as datatypes.
    Ding! and we got a winner.

    However, guess what?

    PLUGIN SDK DOES NOT SUPPORT THIS TYPE OF OUTPUT = =

    See my ultimate problem is?

    I need a solution, and I need one bad.

  4. #4
    Join Date
    December 2009
    Location
    Germany
    Posts
    2,360
    Quote Originally Posted by willy_sunny View Post
    Ding! and we got a winner.

    However, guess what?

    PLUGIN SDK DOES NOT SUPPORT THIS TYPE OF OUTPUT =
    How should I know this? Never used the Plugin SDK.

  5. #5
    Join Date
    December 2009
    Location
    Taiwan
    Posts
    313
    Yeah, I know, I'm ranting + seeking help D:

    The Devs has made it hard enough already for foreign programmers, and now this :cries:

  6. #6
    Join Date
    July 2002
    Location
    Germany
    Posts
    2,191
    You can actually use unicode source files with most compilers. Just make sure you store the file as utf8. This has nothing to do with teamspeak.

  7. #7
    Join Date
    June 2010
    Location
    Alzenau / Germany
    Posts
    97
    Try saving the sourcefile as UNICODE and then convert the text to UTF-8 with something like this:

    wchar_t* text = "Your unicode text goes here";
    char_t destination[1024];
    WideCharToMultiByte(CP_UTF8, 0, text, -1, destination, sizeof(destination), 0, 0);

  8. #8
    Join Date
    December 2009
    Location
    Taiwan
    Posts
    313
    Quote Originally Posted by Peter View Post
    You can actually use unicode source files with most compilers. Just make sure you store the file as utf8. This has nothing to do with teamspeak.
    This has nothing to do with what I was talking about. I'm referring to the "Plugin name", "author name", "descriptions" fields in the TS3 "Plugin Window". For example, this is the code from the SDK

    Code:
    const char* ts3plugin_author()
    {
    return "Willy_Sunny";
    }
    and this will output "Willy_Sunny" for the author name without a problem.

    However, if you do THIS

    Code:
    const char* ts3plugin_author()
    {
    return "威利桑尼";
    }
    It still compiles, but none of them will output as the same as the character displayed above - REGARDLESS IF IT'S SAVED UNDER ANSI/BIG5/UNICODE/UTF-8.

    Now that's the problem, because the code is using CHAR instead W_CHAR! And the client doesn't take W_CHAR as input. see where we are at?

    Quote Originally Posted by MarkR View Post
    Try saving the sourcefile as UNICODE and then convert the text to UTF-8 with something like this:

    wchar_t* text = "Your unicode text goes here";
    char_t destination[1024];
    WideCharToMultiByte(CP_UTF8, 0, text, -1, destination, sizeof(destination), 0, 0);
    Now that's more like a solution to me. I'll give it a try once I'm back at home.

    thanks.

  9. #9
    Join Date
    July 2002
    Location
    Germany
    Posts
    2,191
    Quote Originally Posted by willy_sunny View Post
    Now that's the problem, because the code is using CHAR instead W_CHAR! And the client doesn't take W_CHAR as input. see where we are at?
    This is not the problem, const char* arrays can (and are) used to store utf8 encoded data everywhere. wide char arrays are possibly more useful to utf16 similar encodings, which teamspeak does not use.

    I do not know if the author name is supported to be unicode, if it is it should accept UTF8 input

  10. #10
    Join Date
    June 2008
    Location
    Krn, Germany
    Posts
    510
    I've adjusted the conversion in the client from C-style strings provided by plugins to QString, which is used to display the texts in the dialog. Plugin SDK changes were not required, the update in the client will be available with next release.

    For results see screenshots, looks ok to me.

    If we missed a proper conversion at other places in the plugin SDK, please let us know.

  11. #11
    Join Date
    December 2009
    Location
    Taiwan
    Posts
    313
    Quote Originally Posted by PeterS View Post
    I've adjusted the conversion in the client from C-style strings provided by plugins to QString, which is used to display the texts in the dialog. Plugin SDK changes were not required, the update in the client will be available with next release.

    For results see screenshots, looks ok to me.

    If we missed a proper conversion at other places in the plugin SDK, please let us know.

    So I assume that you've also have fixed this error in the next release as well?

    ts3Functions.requestSendPrivateTextMsg(serverConne ctionHandlerID, "測試文字!", fromID, NULL)
    So we don't have to toy around with the text conversion anymore with this as well?

  12. #12
    Join Date
    June 2010
    Location
    Alzenau / Germany
    Posts
    97
    Quote Originally Posted by PeterS View Post
    If we missed a proper conversion at other places in the plugin SDK, please let us know.
    Probably not 100% the right place, as this does not affect the plugin SDK itself, but the ts3plugin commandline parameter is also not able to handle UTF-8 encoded strings (e.g. nickname=Hein%20Bl%C3%B6d)

  13. #13
    Join Date
    December 2009
    Location
    Taiwan
    Posts
    313
    Quote Originally Posted by MarkR View Post
    Try saving the sourcefile as UNICODE and then convert the text to UTF-8 with something like this:

    wchar_t* text = "Your unicode text goes here";
    char_t destination[1024];
    WideCharToMultiByte(CP_UTF8, 0, text, -1, destination, sizeof(destination), 0, 0);
    unfortunately ...

    wchar_t* text = "Your unicode text goes here"; // returns error Unable to convert const char[XX] to wchar_t&*
    char_t destination[1024];
    WideCharToMultiByte(CP_UTF8, 0, text, -1, destination, sizeof(destination), 0, 0); // Returns error Undefined CP_UTF8

  14. #14
    Join Date
    June 2010
    Location
    Alzenau / Germany
    Posts
    97
    This was supposed to be pseudocode ;-)

    const wchar_t* text = L"Your unicode text goes here";

    I didn't try to put chinese characters manually into a wchar_t array before, but if it doesn't work this way, you can simply make an array of unicode character codes:
    const wchar_t* text = { 0x438b, 0x00 }
    should give a string "事". If you convert this to UTF-8 with the function above, it should work.

  15. #15
    Join Date
    June 2008
    Location
    Krn, Germany
    Posts
    510
    Quote Originally Posted by MarkR View Post
    Probably not 100% the right place, as this does not affect the plugin SDK itself, but the ts3plugin commandline parameter is also not able to handle UTF-8 encoded strings (e.g. nickname=Hein%20Bl%C3%B6d)
    Regardless of being the right place or not (I guess it is), this is a good hint. Adjusted, thanks for the report. Needs new client, no changes to plugin SDK.

    However, what the plugin does with the command input, is another matter. The commandline parse in the test plugin is very simple (and a pain in C anyways). Anything proper would probably be done with C++, but that would be out of the scope of the example plugin.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: June 26th, 2018, 08:56 AM
  2. [No Bug] Unicode Letter Glitch
    By NeroToxin in forum Client Support
    Replies: 1
    Last Post: November 22nd, 2014, 07:07 PM
  3. Replies: 1
    Last Post: March 14th, 2013, 10:06 AM
  4. [Resolved] Resolving UNICODE Hostnames, 3 RC1
    By Letters in forum Windows
    Replies: 4
    Last Post: June 9th, 2011, 12:15 PM
  5. apps.ini no unicode support?
    By DiabloTerrorGF in forum Windows
    Replies: 0
    Last Post: December 26th, 2009, 04:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •