This is a good primer on bytes vs strings:
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/
On June 14, 2022 2:43:54 AM CDT, Antonis Christofides
wrote:
>Exactly. The important t
Exactly. The important thing to remember here is that, in Python 2, a "string"
is actually a list of bytes, whereas a "unicode string" is actually a list of
characters (not a list of unicode characters—just a list of characters). The
confusion arises because, when Python was created, i.e. in 199
I found a way: book.title = titolo.decode('unicode_escape')
it works fine
Il giorno venerdì 10 giugno 2022 alle 21:45:46 UTC+2 Virgilio Ravagli ha
scritto:
> Thank you, Antonis, it works !
> book.title = u'Verità' doesn't give any errors.
>
> Just another step: suppose that the title with accent
Thank you, Antonis, it works !
book.title = u'Verità' doesn't give any errors.
Just another step: suppose that the title with accented letters stays in a
variable, say titolo, and I want to write
book.title = titolo. It gives error. How can I do, when the assignment on
the right is not a constan
Hello,
try this:
book.title = u'Verità'
Regards,
Antonis
P.S. Sorry I was a bit harsh yesterday—I had drunk too much beer :-)
On 10/06/2022 10.50, Virgilio Ravagli wrote:
I have surround book.save with a try...catch...; the exception is: You must
not use 8-bit bytestrings unless you use a
On Fri, Jun 10, 2022 at 6:15 AM Virgilio Ravagli
wrote:
>
> I'm bound to use old versions of Python and Django, cannot pass to newer
> versions in this project
>
https://python.readthedocs.io/en/v2.7.2/howto/unicode.html
maybe that helps
You may also have a severe case of 'can't get there from
I'm bound to use old versions of Python and Django, cannot pass to newer
versions in this project
Il giorno venerdì 10 giugno 2022 alle 12:07:44 UTC+2 ajoeiam ha scritto:
> On Fri, Jun 10, 2022 at 2:50 AM Virgilio Ravagli
> wrote:
> >
> > I have surround book.save with a try...catch...; the exc
On Fri, Jun 10, 2022 at 2:50 AM Virgilio Ravagli
wrote:
>
> I have surround book.save with a try...catch...; the exception is: You must
> not use 8-bit bytestrings unless you use a text_factory that can interpret
> 8-bit bytestrings (like text_factory = str). It is highly recommended that
> you
I have surround book.save with a try...catch...; the exception is: You must
not use 8-bit bytestrings unless you use a text_factory that can interpret
8-bit bytestrings (like text_factory = str). It is highly recommended that
you instead just switch your application to Unicode strings.
Without t
Please read my email again.
Antonis Christofides
+30-6979924665 (mobile)
On 09/06/2022 22.27, Virgilio Ravagli wrote:
All right.
class Book(models.Model):
code = models.PositiveIntegerField(primary_key=True)
title = models.CharField(max_length=60,blank=False,null=False)
book = Bo
All right.
class Book(models.Model):
code = models.PositiveIntegerField(primary_key=True)
title = models.CharField(max_length=60,blank=False,null=False)
book = Book()
book.code = 1
book.title = 'Verità'
book.save()
the code is really simple
Il giorno mercoledì 8 giugno 2022 alle 21:
Please provide the minimum code that reproduces the problem, and the full
traceback.
Regards,
Antonis
On 08/06/2022 18.24, Virgilio Ravagli wrote:
ou must not use 8-bit bytestrings unless you use a text_factory that can
interpret 8-bit bytestrings
--
You received this message because you a
Hi everybody.
I defined a model class, Book, whose field title may contain accented
letters.
But in the case, when the instruction save() is executed, I receive an
error saying that "You must not use 8-bit bytestrings unless you use a
text_factory that can interpret 8-bit bytestrings (like text_
13 matches
Mail list logo