[PATCH] Display decoded IDNs

Michael Drake tlsa at netsurf-browser.org
Mon Jul 20 22:09:33 BST 2015


Hi Chris,

On 20/07/15 19:29, Chris Young wrote:

> I finally got round to the second part of my IDNA work, which is
> allowing the decoded versions of the domain names to be displayed in
> the status and URL bars.

I'm afraid I don't know anything about the IDNA stuff really, and have
not time right now to look through the implementation.  My comments
below are from the nsurl/core netsurf API point of view.

> diff --git a/utils/nsurl.h b/utils/nsurl.h
> index b84f55e..07d73f1 100644
> --- a/utils/nsurl.h
> +++ b/utils/nsurl.h
> @@ -181,6 +181,20 @@ const char *nsurl_access(const nsurl *url);
>
>
>   /**
> + * Access a NetSurf URL object as a UTF-8 string (for human readable IDNA)
> + *
> + * \param url	  NetSurf URL to retrieve a string pointer for.
> + * \return the required string
> + *
> + * It is up to the client to free the returned string when they have
> + * finished with it.
> + *
> + * The returned string has a trailing '\0'.
> + */
> +char *nsurl_access_utf8(const nsurl *url);

The nsurl_access function is purely a convenience to access an internal
string that the caller does not own.

If you make a function which passes ownership of the string to the
caller, it should be in the style of nsurl_get and return an nserror.

For example:

nserror nsurl_get_utf8(const nsurl *url, nsurl_component parts,
             char **url_s, size_t *url_l);

-- 
Michael Drake                      http://www.netsurf-browser.org/



More information about the netsurf-dev mailing list