diff --git a/src/com/android/contacts/dialpad/DialpadFragment.java b/src/com/android/contacts/dialpad/DialpadFragment.java
index 6ba4178..1b0589d 100644
--- a/src/com/android/contacts/dialpad/DialpadFragment.java
+++ b/src/com/android/contacts/dialpad/DialpadFragment.java
@@ -269,14 +269,12 @@
 
         mDigitsContainer = fragmentView.findViewById(R.id.digits_container);
         mDigits = (EditText) fragmentView.findViewById(R.id.digits);
-        mDigits.setKeyListener(DialerKeyListener.getInstance());
+        mDigits.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
         mDigits.setOnClickListener(this);
         mDigits.setOnKeyListener(this);
         mDigits.setOnLongClickListener(this);
         mDigits.addTextChangedListener(this);
-
         PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(getActivity(), mDigits);
-
         // Check for the presence of the keypad
         View oneButton = fragmentView.findViewById(R.id.one);
         if (oneButton != null) {
diff --git a/src/com/android/contacts/dialpad/UnicodeDialerKeyListener.java b/src/com/android/contacts/dialpad/UnicodeDialerKeyListener.java
new file mode 100644
index 0000000..faddcea
--- /dev/null
+++ b/src/com/android/contacts/dialpad/UnicodeDialerKeyListener.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.contacts.dialpad;
+
+import android.telephony.PhoneNumberUtils;
+import android.text.Spanned;
+import android.text.method.DialerKeyListener;
+
+/**
+ * {@link DialerKeyListener} with Unicode support. Converts any Unicode(e.g. Arabic) characters
+ * that represent digits into digits before filtering the results so that we can support
+ * pasted digits from Unicode languages.
+ */
+public class UnicodeDialerKeyListener extends DialerKeyListener {
+    public static final UnicodeDialerKeyListener INSTANCE = new UnicodeDialerKeyListener();
+
+    @Override
+    public CharSequence filter(CharSequence source, int start, int end,
+            Spanned dest, int dstart, int dend) {
+        CharSequence converted = PhoneNumberUtils.replaceUnicodeDigits(source.toString());
+        // PhoneNumberUtils.replaceUnicodeDigits performs a character for character replacement,
+        // so we can assume that start and end positions should remain unchanged.
+        CharSequence result = super.filter(converted, start, end, dest, dstart, dend);
+        if (result == null) {
+            if (source.equals(converted)) {
+                // There was no conversion or filtering performed. Just return null according to
+                // the behavior of DialerKeyListener.
+                return null;
+            } else {
+                // filter returns null if the charsequence is to be returned unchanged/unfiltered.
+                // But in this case we do want to return a modified character string (even if
+                // none of the characters in the modified string are filtered). So if
+                // result == null we return the unfiltered but converted numeric string instead.
+                return converted.subSequence(start, end);
+            }
+        }
+        return result;
+    }
+}
diff --git a/tests/src/com/android/contacts/dialpad/UnicodeDialerKeyListenerTest.java b/tests/src/com/android/contacts/dialpad/UnicodeDialerKeyListenerTest.java
new file mode 100644
index 0000000..3dbe18c
--- /dev/null
+++ b/tests/src/com/android/contacts/dialpad/UnicodeDialerKeyListenerTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.contacts.dialpad;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import com.android.contacts.dialpad.UnicodeDialerKeyListener;
+
+import junit.framework.TestCase;
+/**
+ * Test case for {@link UnicodeDialerKeyListener}.
+ *
+ * adb shell am instrument -w -e class com.android.contacts.dialpad.UnicodeDialerKeyListenerTest \
+       com.android.contacts.tests/android.test.InstrumentationTestRunner
+ */
+@SmallTest
+public class UnicodeDialerKeyListenerTest extends TestCase {
+    private static UnicodeDialerKeyListener mUnicodeDialerKeyListener;
+
+    // Pasted numeric digits should remain unchanged
+    public void testNumericDigits() {
+        // The last 3 arguments don't matter because {@link NumberKeyListener} doesn't care
+        // about dest, dstart, dend in
+        // public CharSequence filter (CharSequence source, int start, int end,
+        //         Spanned dest, int dstart, int dend)
+        // anyway. This applies to all tests.
+        assertEquals(null, mUnicodeDialerKeyListener.filter("111222333", 0, 9, null, 0, 0));
+    }
+
+    // Pasted Arabic digits should be converted to ascii digits
+    public void testArabicDigits() {
+        assertEquals("0123456789", mUnicodeDialerKeyListener.filter("٠١٢٣٤٥٦٧٨٩", 0, 10,
+                null, 0, 0));
+    }
+
+    // Pasted Farsi(Persian) digits should be converted to ascii digits
+    // Note the difference in digits 4, 5 and 6 when compared to arabic. The rest of the digits
+    // look the same compared to the Arabic digits but they actually have different unicode codes.
+    public void testFarsiDigits() {
+        assertEquals("0123456789", mUnicodeDialerKeyListener.filter("۰۱۲۳۴۵۶۷۸۹", 0, 10,
+                null, 0, 0));
+    }
+
+    // This is a rare use case but we should make sure it works all the same.
+    public void testCombinationDigits() {
+        assertEquals("15102849177", mUnicodeDialerKeyListener.filter("۱510٢٨٤۹۱۷۷", 0, 11,
+                null, 0, 0));
+    }
+
+    // Test that a normal digit string with dashes is returned unfiltered
+    public void testDashes() {
+        assertEquals(null, mUnicodeDialerKeyListener.filter("1510-284-9177", 0, 13,
+                null, 0, 0));
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        mUnicodeDialerKeyListener = UnicodeDialerKeyListener.INSTANCE;
+    }
+}
