{"action":"opened","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/10021","labels_url":"https://api.github.com/repos/sympy/sympy/issues/10021/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/10021/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/10021/events","html_url":"https://github.com/sympy/sympy/issues/10021","id":112826671,"number":10021,"title":"Wrong output of `srepr' for unicode symbol","user":{"login":"haimoz","id":4608251,"avatar_url":"https://avatars.githubusercontent.com/u/4608251?v=3","gravatar_id":"","url":"https://api.github.com/users/haimoz","html_url":"https://github.com/haimoz","followers_url":"https://api.github.com/users/haimoz/followers","following_url":"https://api.github.com/users/haimoz/following{/other_user}","gists_url":"https://api.github.com/users/haimoz/gists{/gist_id}","starred_url":"https://api.github.com/users/haimoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haimoz/subscriptions","organizations_url":"https://api.github.com/users/haimoz/orgs","repos_url":"https://api.github.com/users/haimoz/repos","events_url":"https://api.github.com/users/haimoz/events{/privacy}","received_events_url":"https://api.github.com/users/haimoz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-22T15:20:18Z","updated_at":"2015-10-22T15:20:18Z","closed_at":null,"body":"If a symbol is constructed using a unicode string, then `srepr' for this symbol fails to wrap the symbol name with single quotes and the leading 'u', as would for symbols constructed using an ASCII string.  Try the following:\r\n\r\n```\r\n>>> srepr(Symbol('x'))\r\nSymbol('x')\r\n>>> srepr(Symbol(u'x'))\r\nSymbol(x)\r\n>>> Symbol('x') == Symbol(u'x')\r\nTrue\r\n>>> eval(srepr(Symbol('x')))  # should return Symbol('x')\r\nx\r\n>>> eval(srepr(Symbol(u'x')))  # shoudl return Symbol(u'x')\r\nTraceback (most recent call last):\r\n  File \"<console>\", line 1, in <module>\r\n  File \"<string>\", line 1, in <module>\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/symbol.py\", line 77, in __new__\r\n    return Symbol.__xnew_cached_(cls, name, **assumptions)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/cache.py\", line 93, in wrapper\r\n    r = func(*args, **kw_args)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/symbol.py\", line 81, in __new_stage2__\r\n    raise TypeError(\"name should be a string, not %s\" % repr(type(name)))\r\nTypeError: name should be a string, not <class 'sympy.core.symbol.Symbol'>\r\n```\r\n\r\nIt appears that for a unicode string at [sympy/printing/printer.py#L254](https://github.com/sympy/sympy/blob/113cce5a3f53b86657da99b5af737f1dfb04ba63/sympy/printing/printer.py#L254), the possible printers are `unicode`, `basestring`, and `object`.  Somehow, for a unicode string, all these printers are not supported, and as a result, an empty printer is used in [line 260](https://github.com/sympy/sympy/blob/113cce5a3f53b86657da99b5af737f1dfb04ba63/sympy/printing/printer.py#L260), which runs to [sympy/printing/repr.py#L45](https://github.com/sympy/sympy/blob/113cce5a3f53b86657da99b5af737f1dfb04ba63/sympy/printing/repr.py#L45), and results in the plain string without wrapping with single quotes.  The issue might be fixed with using `repr` instead of `str` in [sympy/printing/repr.py#L45](https://github.com/sympy/sympy/blob/113cce5a3f53b86657da99b5af737f1dfb04ba63/sympy/printing/repr.py#L45).  However, I do not have sufficient understanding of the sympy internals to know all possible consequences of doing this.  Could anyone kindly look into this and suggest whether this is the right fix?  Thanks a lot!"}}