问题
I think about switching to DB access library that uses DSN connection - connect("mysql://login:password@database?options"). DSN uses @ as a separator. Does it mean that the password cannot contain @ symbol? Is there other restrictions?
回答1:
Any special characters can be tricky with DSNs, particularly if the language / platform escaping or special character rules decide to intervene.
For Pear style DSNs, which I suppose you are using, it should be safe to use URL encoding to protect special characters (@ == %40
) from being translated incorrectly.
来源:https://stackoverflow.com/questions/7860365/dsn-connection-and-password-with