Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
UTF-8. Вывести print u'Привет мир'.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
moskrc  
View profile   Translate to Translated (View Original)
 More options Nov 23 2009, 3:25 pm
From: moskrc <mos...@gmail.com>
Date: Mon, 23 Nov 2009 12:25:12 -0800 (PST)
Local: Mon, Nov 23 2009 3:25 pm
Subject: UTF-8. Вывести print u'Привет мир'.
Привет! Подскажите как можно работать с юникодом. В моем примере с
кириллицей. Файл такой:

# -*- coding: utf-8 -*-
print u'Привет мир'

Сервер сваливается с 500-й ошибкой. В логах: <type
'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode
characters in position 0-5: ordinal not in range(128)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pashka R.  
View profile   Translate to Translated (View Original)
 More options Nov 23 2009, 4:33 pm
From: "Pashka R." <pashka.rezni...@gmail.com>
Date: Mon, 23 Nov 2009 23:33:47 +0200
Local: Mon, Nov 23 2009 4:33 pm
Subject: Re: UTF-8. Вывести print u'Привет мир'.
В чем редактировали файл? Кодировка его какая?

//wbr Pashka R. <pashka.rezni...@gmail.com>

2009/11/23 moskrc <mos...@gmail.com>:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Koshelev  
View profile   Translate to Translated (View Original)
 More options Nov 23 2009, 4:38 pm
From: Alex Koshelev <daeva...@gmail.com>
Date: Tue, 24 Nov 2009 00:38:21 +0300
Local: Mon, Nov 23 2009 4:38 pm
Subject: Re: UTF-8. Вывести print u'Привет мир'.

Уберите "u" перед строкой.
---
Alex Koshelev

2009/11/23 moskrc <mos...@gmail.com>


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
moskrc  
View profile   Translate to Translated (View Original)
 More options Nov 24 2009, 6:16 am
From: moskrc <mos...@gmail.com>
Date: Tue, 24 Nov 2009 03:16:48 -0800 (PST)
Local: Tues, Nov 24 2009 6:16 am
Subject: Re: UTF-8. Вывести print u'Привет мир'.
Ubuntu 9.10, кодировка utf-8

On 24 ноя, 00:33, "Pashka R." <pashka.rezni...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pashka R.  
View profile   Translate to Translated (View Original)
 More options Nov 24 2009, 7:04 am
From: "Pashka R." <pashka.rezni...@gmail.com>
Date: Tue, 24 Nov 2009 14:04:35 +0200
Local: Tues, Nov 24 2009 7:04 am
Subject: Re: UTF-8. Вывести print u'Привет мир'.
попробуйте в начале написать coding=utf-8 вместо coding: utf-8
//wbr Pashka R. <pashka.rezni...@gmail.com>

2009/11/24 moskrc <mos...@gmail.com>:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
moskrc  
View profile   Translate to Translated (View Original)
 More options Nov 24 2009, 9:27 am
From: moskrc <mos...@gmail.com>
Date: Tue, 24 Nov 2009 06:27:19 -0800 (PST)
Local: Tues, Nov 24 2009 9:27 am
Subject: Re: UTF-8. Вывести print u'Привет мир'.
Хмм.. http://www.python.org/dev/peps/pep-0263/ Забавно, можно и так и
так писать... Ок, спасибо. Попробую.

On 24 ноя, 15:04, "Pashka R." <pashka.rezni...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
moskrc  
View profile   Translate to Translated (View Original)
 More options Nov 24 2009, 9:47 am
From: moskrc <mos...@gmail.com>
Date: Tue, 24 Nov 2009 06:47:23 -0800 (PST)
Local: Tues, Nov 24 2009 9:47 am
Subject: Re: UTF-8. Вывести print u'Привет мир'.
Попробовал. Сделал следующее.
Заменил

# -*- coding: utf-8 -*-

на

# coding=utf-8

В результате ничего не изменилось.

Затем, убрал букву u перед "Привет мир"

И о чудо, на тестовом сервере это заработало, но на удаленном - нет.
Такая же ошибка. Все проверил 101 раз.

И даже если это так заработает - что за бред? Почему u убирать, этож
не 3-й питон? Ничего не понимаю ;)

On 24 ноя, 15:04, "Pashka R." <pashka.rezni...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
moskrc  
View profile   Translate to Translated (View Original)
 More options Nov 25 2009, 11:41 am
From: moskrc <mos...@gmail.com>
Date: Wed, 25 Nov 2009 08:41:05 -0800 (PST)
Local: Wed, Nov 25 2009 11:41 am
Subject: Re: UTF-8. Вывести print u'Привет мир'.
Подскажите, почему u нужно убирать?

On 24 ноя, 00:38, Alex Koshelev <daeva...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Akv  
View profile   Translate to Translated (View Original)
 More options Dec 10 2009, 7:01 am
From: Akv <job10...@gmail.com>
Date: Thu, 10 Dec 2009 04:01:37 -0800 (PST)
Local: Thurs, Dec 10 2009 7:01 am
Subject: Re: UTF-8. Вывести print u'Привет мир'.

> И о чудо, на тестовом сервере это заработало, но на удаленном - нет.

Возможно сам файл не в utf-8. нужно проверить настройку кодировки в
текстовом редакторе, который используете.

у меня так -

#!/usr/bin/env python
# coding:utf-8

print 'Content-Type: text/html'
print ''
print 'Привет мир!'

Все работает.


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google