Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

punycode_encode not work #3

Open
ghost opened this issue Oct 30, 2021 · 0 comments
Open

punycode_encode not work #3

ghost opened this issue Oct 30, 2021 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 30, 2021

punycode_encode not work.

wchar_t my_wchar_utf16[] = L"президент.рф";

size_t num_symv = sizeof(my_wchar_utf16) / sizeof(wchar_t);




   uint32_t* my_uint32;

   my_uint32 = (uint32_t*)malloc(num_symv * sizeof(uint32_t));

   memset(my_uint32, 0, num_symv * sizeof(uint32_t));



   for (int i = 0; i < kol_vo_symv; i++)
   {
       memcpy((char*)(&my_uint32[i]), (char*)(&my_wchar_utf16[i]), sizeof(wchar_t));
   }



   size_t output_length = 100;
   char my_char[100] = {0};



   size_t status = punycode_encode(my_uint32, num_symv ,  my_char, &output_length);


  std::cout << status << std::endl;

  std::cout << my_char << std::endl;

punycode_encode() return -----> 13, but but there is garbage inside the my_char, there is no punicode, there is garbage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants