Code Monkey home page Code Monkey logo

Comments (10)

netcarver avatar netcarver commented on June 18, 2024

Hello hupf,

Perhaps I'm missing something here - but wouldn't this suggestion also violate RFC3986? AFAIK, that RFC says to percent encode unicode characters. More info in the current standard section on Wikipedia. I could be wrong in my interpretation though.

from python-textile.

hupf avatar hupf commented on June 18, 2024

Hi netcarver,

That may be right. So the correct way to do it, would be to parse the domain part and the rest of the URL separately, then encode the domain part appropriately (xn--...) and percent encode the rest of the URL...

from python-textile.

hupf avatar hupf commented on June 18, 2024

I found out, that the autoLink() method already violates RFC3986. It matches URLs with Unicode characters, but it doesn't percent encode them, so the produced links may contain Unicode characters.

Maybe this should be fixed too?

from python-textile.

netcarver avatar netcarver commented on June 18, 2024

Hi hupf,

You are probably right re autoLink(). I was just flagging RFC3986 for consideration as this issue has come up for me in PHP Textile and I'll be looking to work on it for that project soon too.

from python-textile.

chrisdrackett avatar chrisdrackett commented on June 18, 2024

Thanks for this, I'll take a deeper look as well.

from python-textile.

netcarver avatar netcarver commented on June 18, 2024

hupf, Chris,

some of this Textpattern forum post may be of interest as may the new unicode-links branch on PHP Textile which is my first (and incomplete) attempt at this for non-restricted mode links, though I am still having a little trouble getting Japanese chars through the regex.

from python-textile.

chrisdrackett avatar chrisdrackett commented on June 18, 2024

yeah, I suck at regex, which makes me a terrible maintainer for this project ;)

from python-textile.

hupf avatar hupf commented on June 18, 2024

In the commit above, I used and fixed an implementation I found on Stack Overflow to encode the URLs correctly (host part as IDNA ant the path part as per RFC 3986): http://stackoverflow.com/questions/804336/best-way-to-convert-a-unicode-url-to-ascii-utf-8-percent-escaped-in-python/804380#804380

from python-textile.

hupf avatar hupf commented on June 18, 2024

Here is my branch with a working implementation of the URL encoding: https://github.com/atizo/python-textile/tree/unicode-links

from python-textile.

sebix avatar sebix commented on June 18, 2024

Fixed in textile/python-textile == version on pip

from python-textile.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.