Regular expression

Soltys soltys at noabuse.com
Fri Jun 20 01:58:56 EDT 2008


Hi,
Your post is not about re, but about encoding, next time
be more careful when choosing topic for your post!
Did you check what pep0263 says about encoding?
One of the first thins it says is:

"(...)
Defining the Encoding
Python will default to ASCII as standard encoding if no other
     encoding hints are given.
(...)"

So when you're using non ASCII characters you should always
specify encoding. Here again, read pep0263 for how this can
be done, especially section Defining Encoding, where there
are multiple ways of doing that.


Sallu pisze:
> Hi All,
> here i have on textbox in which i want to restrict the user to not
> enter the 'acent character' like ( é )
> i wrote the program
> 
> import re
> value="this is Praveen"
> #value = 'riché gerry'
> if(re.search(r"^[A-Za-z0-9]*$",value)):
>   print "Not allowed accent character"
> else:
>   print "Valid"
> 
> output :
> 
> sys:1: DeprecationWarning: Non-ASCII character '\xc3' in file regu1.py
> on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html
> for details
> Valid
> 
> when i make comment #value="this is Praveen" and released comment
> value = 'riché gerry'
> but still i am getting same output even it have accent character.


-- 
Soltys

"Free software is a matter of liberty not price"



More information about the Python-list mailing list