/// <summary>
        /// Converts the range from lastSafe to limit.
        /// </summary>
        ///
        /// <param name="verify">If non-null, check to see that all replacement characters arein it. If not, abort the conversion and returnInteger.MIN_VALUE.</param>
        /// <returns>return the delta in length (new - old), or Integer.MIN_VALUE if
        /// the verify aborted.</returns>
        internal int Convert(Replaceable text, int lastSafe, int limit, UnicodeSet verify)
        {
            // System.out.println("t: " +
            // com.ibm.icu.impl.Utility.hex(text.toString()) + ", s: " + lastSafe +
            // ", l: " + limit);

            int    len   = limit - lastSafe;
            String input = null;

            lock (buffer) {
                if (buffer.Length < len)
                {
                    buffer = new char[len];             // rare, and we don't care if we grow
                                                        // too large
                }
                text.GetChars(lastSafe, limit, buffer, 0);
                input = new String(buffer, 0, len);             // TODO: fix normalizer to take
                                                                // char[]
            }
            String output = IBM.ICU.Text.Normalizer.Normalize(input, mode, options);

            // verify OK, if specified
            if (verify != null)
            {
                bool skip = !skippable.ContainsAll(output);
                if (DEBUG)
                {
                    System.Console.Out.WriteLine(((skip) ? "  SKIP: " : "NOSKIP: ")
                                                 + IBM.ICU.Impl.Utility.Escape(input) + " => "
                                                 + IBM.ICU.Impl.Utility.Escape(output));
                }
                if (skip)
                {
                    return(Int32.MinValue);
                }
            }

            if (output.Equals(input))
            {
                return(0);
            }
            text.Replace(lastSafe, limit, output);
            return(output.Length - len);
        }