non ISO utf8 characters are not displayed properly from static library on Linux
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: non ISO utf8 characters are not displayed properly from static library on Linux

  1. #1
    Join Date
    Apr 2017
    Posts
    8

    non ISO utf8 characters are not displayed properly from static library on Linux

    I have main.cpp utf8 (no BOM) file where let say function1 (string &strtocompare) is called.string strtocompare = "ČĆĐ". Function1 is defined in stringFunction.cpp utf8 file from static library as:

    function1 (string &strtocompare)
    (

    string refstrinsmall = "čćđ";
    string refstringbig = "ČĆĐ"

    ..

    )
    Linux, gcc 6.2.0

    What is happened that the function is not working as expected. gdb shows that strtocompare has different encoding than refstringbig and refstrinsmall strings. Why is that? Both files are utf-8 created by notepad++, file Linux command shows that all three files are utf8. I can see clearly strtocompare as ČĆĐ but:
    refstringsmall _M_p = 0x82ada8 "\310\306Њ\216"}

    How could I solve this problem?

  2. #2
    Join Date
    Jun 2003
    Location
    Armenia, Yerevan
    Posts
    696

    Re: non ISO utf8 characters are not displayed properly from static library on Linux

    If you're working in a cross-platform environment, there could be issues with file formats on a Windows system and Linux, probably you need to properly choose the encoding using notepad++.
    Popular opinion is the greatest lie in the world.

  3. #3
    Join Date
    Apr 2017
    Posts
    8

    Re: non ISO utf8 characters are not displayed properly from static library on Linux

    Quote Originally Posted by AvDav View Post
    If you're working in a cross-platform environment, there could be issues with file formats on a Windows system and Linux, probably you need to properly choose the encoding using notepad++.
    Yes, you are right cross platform. However, I do check both files and both files are encoded as UTF-8....
    And I expect that both are utf-8 string as it is above. No need to encode with -fexec-charset="cp1250", if they are both in UTF-8?

  4. #4
    Join Date
    Jun 2003
    Location
    Armenia, Yerevan
    Posts
    696

    Re: non ISO utf8 characters are not displayed properly from static library on Linux

    Quote Originally Posted by Pancevo1956 View Post
    Yes, you are right cross platform. However, I do check both files and both files are encoded as UTF-8....
    And I expect that both are utf-8 string as it is above. No need to encode with -fexec-charset="cp1250", if they are both in UTF-8?
    I have no idea. However, during programming for a Windows systems there is a _T() or TEXT() marcos available during dealing with both ANSI-string and Unicode characters. I'm assured, there must some similar trick made for *nix-oriented OSes.
    Popular opinion is the greatest lie in the world.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)