Re: Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie
On Jul 6, 4:44 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-06 at 07:25 -0700, web-junkie wrote: > > Thanks for your reply. I'll give more information: > > > # c:\django_src\django\core\handlers\base.py in get_response > > > 77. response = callback(request, *callback_args

Re: Feeds don't work with Unicode URLs

2007-07-06 Thread Malcolm Tredinnick
On Fri, 2007-07-06 at 07:25 -0700, web-junkie wrote: > Thanks for your reply. I'll give more information: > > # c:\django_src\django\core\handlers\base.py in get_response > > 77. response = callback(request, *callback_args, > **callback_kwargs) ... > > # c:\django_src\django\contrib\syndicat

Re: Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie
assed to the feed object from request.path On Jul 6, 4:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-06 at 06:51 -0700, web-junkie wrote: > > Hi, I have a problem of getting my feeds to work with unicode URLs. > > > File "/usr/local/lib/pytho

Re: Feeds don't work with Unicode URLs

2007-07-06 Thread Malcolm Tredinnick
On Fri, 2007-07-06 at 06:51 -0700, web-junkie wrote: > Hi, I have a problem of getting my feeds to work with unicode URLs. > > File "/usr/local/lib/python2.4/site-packages/django/contrib/ > syndication/feeds.py", line 12, in add_domain >url = u&#x

Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie
Hi, I have a problem of getting my feeds to work with unicode URLs. File "/usr/local/lib/python2.4/site-packages/django/contrib/ syndication/feeds.py", line 12, in add_domain url = u'http://%s%s' % (domain, url) UnicodeDecodeError: 'ascii' codec can

Re: Unicode URLs

2006-12-25 Thread Aaron Jacobs
an issue at all. If you want to handle 'unicode' URLs, you should assume that the URLs are UTF8 and decode the path as such. Yeah, that's what I wound up doing. http://groups.google.com/group/django-users/browse_thread/thread/52349f0968f5b36b/07adcb5763a09a5a In my UTF8 decodi

Re: Unicode URLs

2006-12-24 Thread Victor Ng
In [6]: '/'.decode('gb18030') Out[6]: u'/' In [7]: '/'.decode('gb2312') Out[7]: u'/' How are you getting a chinese block character for 0x2f? If you want to handle 'unicode' URLs, you should assume that the URLs are UTF

Re: Unicode URLs

2006-12-24 Thread James Bennett
On 12/23/06, Aaron Jacobs <[EMAIL PROTECTED]> wrote: In the interest of making 'pretty' URLs, I want my application to accept URLs that may potentially contain Chinese characters, and have those URLs parsed by URLconfs. Just keep in mind that in some browsers it won't be "pretty" at all; inste

Re: Unicode URLs

2006-12-23 Thread Aaron Jacobs
On 12/23/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: Yep. If you haven't seen it, Wikipedia has excellent coverage of unicode, including utf-8: http://en.wikipedia.org/wiki/Utf-8 Yeah, that's actually where I wound up reading about it. Specifically, its property of not allowing the bytes enc

Re: Unicode URLs

2006-12-23 Thread Jeremy Dunck
On 12/23/06, Aaron Jacobs <[EMAIL PROTECTED]> wrote: ... after reading a bit about UTF-8, it sounds like `0x2F` is never used in anything but the forward slash. Yep. If you haven't seen it, Wikipedia has excellent coverage of unicode, including utf-8: http://en.wikipedia.org/wiki/Utf-8 Even

Re: Unicode URLs

2006-12-23 Thread Aaron Jacobs
After researching it some more, it seems that Django uses UTF-8 byte strings internally (as opposed to the actual Unicode strings that Python supports). So the following regular expression actually does work: r"^name/(?P[^/]+)/$" What is passed in the `name` parameter is a UTF-8 byte s

Re: Unicode URLs

2006-12-23 Thread Aaron Jacobs
On 12/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Maybe I'm not quite sure what you're problem is :) I want to parse a URL matching the following regular expression: r"name/(?P[^/]+)/" That is, a URL of the form `name/Johnson/`, where 'Johnson' gets passed to my view. But th

Re: Unicode URLs

2006-12-23 Thread Aaron Jacobs
On 12/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Sorry, here: http://dpaste.com/4010/ Forgive me if I'm wrong, but it seems that that is just a function to make Unicode strings into ASCII strings, losing data in the process. That's not what I want; I want to support URLs with non-ASCI

Re: Unicode URLs

2006-12-23 Thread [EMAIL PROTECTED]
Maybe I'm not quite sure what you're problem is :) On Dec 23, 5:44 pm, "Aaron Jacobs" <[EMAIL PROTECTED]> wrote: On 12/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry, here:http://dpaste.com/4010/Forgive me if I'm wrong, but it seems that that is just a function to make Unicode st

Re: Unicode URLs

2006-12-23 Thread [EMAIL PROTECTED]
Sorry, here: http://dpaste.com/4010/ On Dec 23, 1:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Maybe this will help you: def safe_name(name = None): if name == None: return None name = str2url(name) name = sub(r"[^a-zA-Z0-9\-_\s\.]", "", name)

Re: Unicode URLs

2006-12-23 Thread [EMAIL PROTECTED]
Maybe this will help you: def safe_name(name = None): if name == None: return None name = str2url(name) name = sub(r"[^a-zA-Z0-9\-_\s\.]", "", name) name = sub(r"[\s\._]", "-", name) name = sub(r"[-]+", "-", name) return name.strip("

Unicode URLs

2006-12-22 Thread Aaron Jacobs
In the interest of making 'pretty' URLs, I want my application to accept URLs that may potentially contain Chinese characters, and have those URLs parsed by URLconfs. The [Django book] [1] says the following: When a request comes in, Django tries to match the URLconf patterns against the reque

unicode urls (not domains)

2006-11-08 Thread [EMAIL PROTECTED]
Does anyone know how much trouble I'll get myself into if I try to use Norwegian characters in urlpatterns, e.g. I'd like to map the url foo/blåbærsyltetøy. I've noticed that if you type that into your browser's address bar each browser does its own thing, Firefox url-encodes it using a iso-8859-