Deutsch English Français Italiano |
<v0jh4g$h14g$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: jak <nospam@please.ty> Newsgroups: comp.lang.python Subject: UTF_16 question Date: Sat, 27 Apr 2024 20:45:35 +0200 Organization: A noiseless patient Spider Lines: 15 Message-ID: <v0jh4g$h14g$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 27 Apr 2024 20:45:36 +0200 (CEST) Injection-Info: dont-email.me; posting-host="48bf1fe914c1564bbdf160bf0eb11031"; logging-data="558224"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GYW2GUAtU4NhEJmYdW1VE" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.2 Cancel-Lock: sha1:HkQVe+FLsYOnXrAhhIiW6nuVwgE= X-Mozilla-News-Host: snews://news.eternal-september.org:563 Bytes: 1772 Hi everyone, one thing that I do not understand is happening to me: I have some text files with different characteristics, among these there are that they have an UTF_32_le coding, utf_32be, utf_16_le, utf_16_be all of them without BOM. With those utf_32_xx I have no problem but with the UTF_16_xx I have. If I have an utf_16_le coded file and I read it with encoding='utf_16_le' I have no problem I read it, with encoding='utf_16_be' I can read it without any error even if the data I receive have the inverted bytes. The same thing happens with the utf_16_be codified file, I read it, both with encoding='utf_16_be' and with 'utf_16_le' without errors but in the last case the bytes are inverted. What did I not understand? What am I doing wrong? thanks in advance