473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

about a head line

I saw some scripts have a line at its begin:

# encoding:gb2312

what's this? Why need it? thanks.

Jun 27 '08 #1
3 839
Penny Y. wrote:
I saw some scripts have a line at its begin:

# encoding:gb2312

what's this? Why need it? thanks.
My guess is that it is the automatic work of some sort of editor that
does not understand how encodings work. See what happens if the file was
utf-16le encoded, for example. I think you can safely remove it.
Jun 27 '08 #2
On Apr 17, 5:54 pm, "Penny Y." <pyli...@arcor.dewrote:
I saw some scripts have a line at its begin:

# encoding:gb2312

what's this? Why need it? thanks.
declaring of the encoding used in the source file.
it's like <meta http-equiv="Content-type" content="text/html;
charset=gb2312" /in html

take gb2312 as an example.
you will need it if you have some chinese char in the source file
which uses gb2312 for the file encoding.
if not, you might get an error like: SyntaxError: Non-ASCII
character .........
Jun 27 '08 #3
Penny Y. pisze:
I saw some scripts have a line at its begin:

# encoding:gb2312

what's this? Why need it? thanks.
Have a look at PEP-0263 (http://www.python.org/dev/peps/pep-0263/)
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: felipe_azv | last post by:
a got this code in asp to construct a xml , to export it to a url this is de asp code: <% SQL = "Select * from User where CodeUser in ("& request.form("C1" &")" set rs =...
1
by: Zhiyao | last post by:
I want to write a program which can read strings, one per line, from standard input, and the program builds a list of strings then prints it. The code is listed below, when I compile it, there is no...
3
by: Kane | last post by:
When you create node 1 you allocate memory and link it Again when you create node 2 you would allocate memory for that node in a different section of the code. Is there more efficient way where I...
34
by: vpriya6 | last post by:
Hi guys, I am new to Ajax, xml and javascript. I want to know how can I retrieve data from xml and display in the html page? please help me out. suppose my xml file is customer.xml the code...
5
by: fishfin | last post by:
I was working through a tutorial about how to write a server using python (the url is bellow). I am sure that the server is working to some degree because when the server is running localhost:8080...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.