[ome-users] setdn ldap special character

Josh Moore josh at glencoesoftware.com
Tue Aug 30 09:40:07 BST 2011


Hi Chris,

If you want to go from \xc3\xa1 to u'\xe1' then use:

In [2]: unicode('\xc3\xa1', 'utf-8')
Out[2]: u'\xe1'

or

In [3]: str('\xc3\xa1').decode('utf-8')
Out[3]: u'\xe1'


For example:

# setdn.py
import subprocess
subprocess.call(["bin/omero", "ldap", "setdn", "cwood", unicode("\xc3\xa1", "utf-8")])
subprocess.call(["bin/psql", "43d", "-c", "select dn from password where experimenter_id = 2"])

prints:

~/git/dist $ python setdn.py 
Using session 51b218ba-0180-45d6-a92c-96b4a1828ed1 (root at localhost:4064). Idle timeout: 10.0 min. Current group: system
 dn 
----
 á
(1 row)



To go back again:

In [18]: unicode("\xc3\xa1", "utf-8").encode("utf-8")
Out[18]: '\xc3\xa1'


Cheers,
~Josh.


On Aug 29, 2011, at 10:56 PM, Wood, Christopher wrote:

> Hi,
> 
> I use "omero ldap setdn dn" to let users use their regular passwords for Omero. I run a python script to get the distinguished name, and then run the setdn command.
> 
> I have a name with a special character, á, that python returns a \xc3\xa1, that I think should be u'\xe1'.
> 
> How do I put this into the command line?
> 
> Thanks
> Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 243 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20110830/af4d26b4/attachment.sig>


More information about the ome-users mailing list