From 3912ae3f890b6acf706b7f9e4eb3d0e212522114 Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Wed, 21 Nov 2001 20:56:50 +0000 Subject: [PATCH] ICU-1533 incorporate Mark's review comments X-SVN-Rev: 7056 --- .../src/com/ibm/icu/text/NameUnicodeTransliterator.java | 9 +++++---- icu4j/src/com/ibm/text/NameUnicodeTransliterator.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/icu4j/src/com/ibm/icu/text/NameUnicodeTransliterator.java b/icu4j/src/com/ibm/icu/text/NameUnicodeTransliterator.java index a7a202d1c3..80e27fb887 100755 --- a/icu4j/src/com/ibm/icu/text/NameUnicodeTransliterator.java +++ b/icu4j/src/com/ibm/icu/text/NameUnicodeTransliterator.java @@ -3,8 +3,8 @@ * others. All Rights Reserved. * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NameUnicodeTransliterator.java,v $ - * $Date: 2001/11/17 20:45:35 $ - * $Revision: 1.4 $ + * $Date: 2001/11/21 20:56:50 $ + * $Revision: 1.5 $ */ package com.ibm.text; import java.util.*; @@ -111,12 +111,13 @@ class NameUnicodeTransliterator extends Transliterator { int ch = UCharacter.getCharFromName(new String(buf, 0, ibuf)); if (ch != -1) { // Lookup succeeded - text.replace(openPos, cursor+1, String.valueOf((char) ch)); + String str = UTF16.valueOf(ch); + text.replace(openPos, cursor+1, str); // Adjust indices for the change in the length of // the string. Do not assume that str.length() == // 1, in case of surrogates. - int delta = cursor + 1 - openPos - 1/*str.length()*/; + int delta = cursor + 1 - openPos - str.length(); cursor -= delta; limit -= delta; // assert(cursor == openPos + str.length()); diff --git a/icu4j/src/com/ibm/text/NameUnicodeTransliterator.java b/icu4j/src/com/ibm/text/NameUnicodeTransliterator.java index 1f2b52a881..4283672698 100755 --- a/icu4j/src/com/ibm/text/NameUnicodeTransliterator.java +++ b/icu4j/src/com/ibm/text/NameUnicodeTransliterator.java @@ -3,8 +3,8 @@ * others. All Rights Reserved. * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/NameUnicodeTransliterator.java,v $ - * $Date: 2001/11/17 20:45:35 $ - * $Revision: 1.4 $ + * $Date: 2001/11/21 20:56:50 $ + * $Revision: 1.5 $ */ package com.ibm.text; import java.util.*; @@ -111,12 +111,13 @@ class NameUnicodeTransliterator extends Transliterator { int ch = UCharacter.getCharFromName(new String(buf, 0, ibuf)); if (ch != -1) { // Lookup succeeded - text.replace(openPos, cursor+1, String.valueOf((char) ch)); + String str = UTF16.valueOf(ch); + text.replace(openPos, cursor+1, str); // Adjust indices for the change in the length of // the string. Do not assume that str.length() == // 1, in case of surrogates. - int delta = cursor + 1 - openPos - 1/*str.length()*/; + int delta = cursor + 1 - openPos - str.length(); cursor -= delta; limit -= delta; // assert(cursor == openPos + str.length());