diff --git a/mercurial/windows.py b/mercurial/windows.py
index 48f07adbda983363af1ce84fd692a42f303e0093_bWVyY3VyaWFsL3dpbmRvd3MucHk=..064cd182555f9d0caa50c9f05fa1c0499b3a00fe_bWVyY3VyaWFsL3dpbmRvd3MucHk= 100644
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -200,6 +200,6 @@
     This shouldn't be called directly- use ``ui.getpass()`` instead, which
     checks if the session is interactive first.
     """
-    pw = ""
+    pw = u""
     while True:
         c = msvcrt.getwch()  # pytype: disable=module-attr
@@ -204,4 +204,4 @@
     while True:
         c = msvcrt.getwch()  # pytype: disable=module-attr
-        if c == '\r' or c == '\n':
+        if c == u'\r' or c == u'\n':
             break
@@ -207,3 +207,3 @@
             break
-        if c == '\003':
+        if c == u'\003':
             raise KeyboardInterrupt
@@ -209,5 +209,5 @@
             raise KeyboardInterrupt
-        if c == '\b':
+        if c == u'\b':
             pw = pw[:-1]
         else:
             pw = pw + c
@@ -211,9 +211,9 @@
             pw = pw[:-1]
         else:
             pw = pw + c
-    msvcrt.putwch('\r')  # pytype: disable=module-attr
-    msvcrt.putwch('\n')  # pytype: disable=module-attr
-    return encoding.strtolocal(pw)
+    msvcrt.putwch(u'\r')  # pytype: disable=module-attr
+    msvcrt.putwch(u'\n')  # pytype: disable=module-attr
+    return encoding.unitolocal(pw)
 
 
 class winstdout(object):