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

urlapi: add ability to convert back from punycode to IDN name #11655

Closed
wants to merge 8 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Aug 11, 2023

No description provided.

@bagder
Copy link
Member Author

bagder commented Aug 11, 2023

I wrote the windows code "blind" based on this documentation.

@bagder bagder added the feature-window A merge of this requires an open feature window label Aug 11, 2023
@bagder
Copy link
Member Author

bagder commented Aug 11, 2023

So 4 Windows builds fail, the others work!? The test 1560 error output is awesomely weird and hard to detect. in Circle CI it looks like this:

 URL: -
 in: https://xn--rksmrgs-5wao1o.se
 wanted: https | [11] | [12] | [13] | räksmörgås.se | [15] | / | [16] | [17]
 got:    https | [11] | [12] | [13] | räksmörgås.se | [15] | / | [16] | [17]

But when I copy and pasted it here, it shows:

 URL: -
 in: https://xn--rksmrgs-5wao1o.se
 wanted: https | [11] | [12] | [13] | räksmörgås.se | [15] | / | [16] | [17]
 got:    https | [11] | [12] | [13] | räksmörgås.se� | [15] | / | [16] | [17]

Assuming I get the correct trailing byte, it is 0x16.

@jay
Copy link
Member

jay commented Aug 11, 2023

got: https | [11] | [12] | [13] | räksmörgås.se� | [15] | / | [16] | [17]

I think you should have passed the length of in_w + 1. it says pass the count of characters of param lpASCIICharStr (which is in wide characters) and +1 is needed because of this: "The retrieved string is null-terminated only if the input string is null-terminated."

i don't know where -1 comes from maybe that was in earlier versions of the doc i will check

@bagder
Copy link
Member Author

bagder commented Aug 11, 2023

I just guessed on the -1 since it seems to work for the conversion in the other direction...

@jay
Copy link
Member

jay commented Aug 11, 2023

I just guessed on the -1 since it seems to work for the conversion in the other direction...

I just checked an old Windows SDK offline documentation from Windows 7 2009 and I do not see it documented there either so I don't know why we did it that way. I will change it.

@bagder
Copy link
Member Author

bagder commented Aug 12, 2023

awesome @jay, that seems to have done it!

@bagder bagder closed this in c350069 Aug 13, 2023
@bagder bagder deleted the bagder/puny2idn branch August 13, 2023 13:35
ptitSeb pushed a commit to wasix-org/curl that referenced this pull request Sep 25, 2023
vszakats added a commit to vszakats/hb that referenced this pull request May 7, 2024
Upcoming in libcurl 8.3.0

curl/curl@c350069
curl/curl#11655

Origin: e9ce94d7a6706b8cf283c088504953864e590474
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-window A merge of this requires an open feature window libcurl API tests
Development

Successfully merging this pull request may close these issues.

None yet

2 participants