Yes, it is hard to determine the question. However, a stab in the dark, you
are trying to get a <br /> tag to display a new line in a django template?
If so, any HTML that you want to render on the display needs to be passed
with the mark_safe() function. For example in views.py

from django.utils.safestring import mark_safe

def helloWorld(request):
    message = "<span style='font-weight: bold;'>Hello</span> <br /> &nbsp;
&nbsp; &nbsp; <span style='color: red;'>World!</span>"
    return render_to_response('hello_template.htm', {'message':
mark_safe(message)}, context_instance=RequestContext(request))


hello_template.htm:

<!doctype html>

<html lang="en">
<head>
<title>Hello, World!</title>
 <meta charset="utf-8" />
</head>
 <body>
 {% if message %}
  {{ message }}
 {% endif %}
 </body>
</html>

Produces a page like:
Hello
      World!

Without mark_safe(message) page just displays HTML not rendered in plain
text:
      <span style='font-weight: bold;'>Hello</span> <br /> &nbsp; &nbsp;
&nbsp; <span style='color: red;'>World!</span>

Hope that helps. If you are talking about manipulating characters, see
http://stackoverflow.com/questions/227459/ascii-value-of-a-character-in-python.
You can use ord() and chr() to switch carriage return/line feeds using the
ascii ordinal representation and back if you need to.

Furbee

2011/12/13 Tom Evans <tevans...@googlemail.com>

> 2011/12/13 Germán <germanlarra...@gmail.com>:
> > Has anybody solved this issue?
> >
> > On Dec 14 2006, 2:47 pm, "Aidas Bendoraitis"
> > <aidas.bendorai...@gmail.com> wrote:
> >> I ran out of ideas. :) Maybe somebody else has any thoughts regarding
> new lines?
> >>
> >> Good luck with Django!
> >> Aidas Bendoraitis [aka Archatas]
> >>
> >> On 12/14/06, zhongke chen <czk19790...@gmail.com> wrote:
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> > firefox shows utf-8
> >>
> >> > my firefox is 2.0
> >>
> >> > On 12/14/06, Aidas Bendoraitis <aidas.bendorai...@gmail.com> wrote:
> >> > > And what encoding is showed in the page info? ...when you right
> click
> >> > > somewhere in the page and choose "View Page Info" from the menu.
> Maybe
> >> > > just the default character encoding in your firefox settings is set
> >> > > wrongly?
> >>
> >> > > You can always override admin templates copying them into your
> >> > > custom_templates/admin directory.
> >>
> >> > > Regards,
> >> > > Aidas Bendoraitis
> >>
> >> > > On 12/14/06, zhongke chen <czk19790...@gmail.com> wrote:
> >> > > > It's not my html page, but the django admin page.
> >>
> >> > > > the head of admin page is like this:
> >>
> >> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> >> > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> >> > > > <html xmlns="http://www.w3.org/1999/xhtml"; lang="zh-cn"
> xml:lang="zh-cn" >
> >> > > > <head>
> >> > > > <title>站点管理员</title>
> >> > > > <link rel="stylesheet" type="text/css"
> >> > > > href="/oj/adminmedia/css/dashboard.css" />
> >> > > > </head>
> >>
> >> > > > no encoding here, but lang = 'zh-cn'.
> >>
> >> > > > and all chinese characters in my pages and mysql are encoded in
> UTF-8.
> >> > > > Locale of my server is like this:
> >>
> >> > > > LANG=zh_CN.UTF-8
> >> > > > LANGUAGE=zh_CN:zh:en_US:en
> >> > > > LC_CTYPE="zh_CN.UTF-8"
> >> > > > LC_NUMERIC="zh_CN.UTF-8"
> >> > > > LC_TIME="zh_CN.UTF-8"
> >> > > > LC_COLLATE="zh_CN.UTF-8"
> >> > > > LC_MONETARY="zh_CN.UTF-8"
> >> > > > LC_MESSAGES="zh_CN.UTF-8"
> >> > > > LC_PAPER="zh_CN.UTF-8"
> >> > > > LC_NAME="zh_CN.UTF-8"
> >> > > > LC_ADDRESS="zh_CN.UTF-8"
> >> > > > LC_TELEPHONE="zh_CN.UTF-8"
> >> > > > LC_MEASUREMENT="zh_CN.UTF-8"
> >> > > > LC_IDENTIFICATION="zh_CN.UTF-8"
> >> > > > LC_ALL=
> >>
> >> > > > On 12/13/06, Aidas Bendoraitis <aidas.bendorai...@gmail.com>
> wrote:
> >> > > > > It might be that it treats new lines as \r\n when you are using
> some
> >> > > > > windows-* encoding for your html pages. Check the source code.
> I would
> >> > > > > rather use UTF-8 in any case.
> >>
> >> > > > > Regards
> >> > > > > Aidas Bendoraitis [aka Archatas]
> >>
> >> > > > --
> >> > > > Yours, Zhongke Chen 陈忠克
> >>
> >> > --
> >> > Yours, Zhongke Chen 陈忠克
> >>
> >> > 欢迎访问温州本地Linux论坛:http://groups.google.com/group/linux-wz
> >>
> >> > 请用czk19790...@gmail.com
> 与我联系,本人其它的邮箱已不再使用。如果要发word/excel/ppt文件给我,请先转成PDF格式。谢谢!PLEASE
> >> > contact me using czk19790...@gmail.com from now on. Other mail boxes
> >> > have been deprecated. If you want to attach word/excel/powerpoint
> >> > files for me, PLEASE convert them to pdf. Thanks a lot.
> >
>
> If there is a question in that mass of forwarded emails, I could not
> find it. The most important thing when getting help is to precisely
> and concisely state what your problem is. I'd start from there.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to