<font face="georgia,serif">Great, thanks!</font><div><font face="georgia,serif"><br clear="all"></font><font face="georgia, serif">Mark<br><br><i>— Il meglio è l’inimico del bene —</i></font><br>
<br><br><div class="gmail_quote">On Thu, Jan 27, 2011 at 12:50, Xueming Shen <span dir="ltr">&lt;<a href="mailto:xueming.shen@oracle.com">xueming.shen@oracle.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


  
    
  
  <div text="#000000" bgcolor="#ffffff">
    Mark,<br>
    <br>
    The high/lowSurrogate(codepoint) pair has been added in jdk1.7
    already.<br>
    <br>
    <a href="http://download.java.net/jdk7/docs/api/java/lang/Character.html#highSurrogate%28int%29" target="_blank">http://download.java.net/jdk7/docs/api/java/lang/Character.html#highSurrogate(int)</a><br>
    <a href="http://download.java.net/jdk7/docs/api/java/lang/Character.html#lowSurrogate%28int%29" target="_blank">http://download.java.net/jdk7/docs/api/java/lang/Character.html#lowSurrogate(int)</a><br>
    <br>
    I submitted CR#7015408 for the third (formatting) one.<br>
    <br>
    -Sherman<div class="im"><br>
    <br>
    On 01/26/2011 01:36 PM, Mark Davis ☕ wrote:
    <blockquote type="cite"><font face="arial, helvetica,
        sans-serif">Ok, now I understand. With that change, the
        situation is much better. It doesn&#39;t fully satisfy 
        
        <span style="border-collapse:collapse">RL1.1, because you can&#39;t use hex codepoint numbers
          -- you have to use the fairly ugly workaround of</span></font>
      <div>
        <span style="font-family:arial,sans-serif;border-collapse:collapse"><br>
        </span></div>
      
      <font color="#500050" face="&#39;courier
        new&#39;, monospace"><span style="border-collapse:collapse">
          
          
          
          
          
          
          <p>
            
            
            
            
            
            </p>
          <p>String hexPattern = codePoint &lt;= 0xFFFF </p>
          <p>? String.format(<span>&quot;\\u%04x&quot;</span>,
            codePoint) </p>
          <p>: String.format(<span>&quot;\\u%04x\\u%04x&quot;</span>,
            (<span>int</span>)
            Character.toChars(codePoint)[0], (<span>int</span>)
            Character.toChars(codePoint)[1]);</p>
        </span></font>
      <div>
        <div><span style="font-family:georgia,serif"><br>
          </span></div>
        <div><span style="font-family:arial,helvetica,sans-serif"><br>
          </span></div>
        <div><span style="font-family:arial,helvetica,sans-serif">BTW, in plain Java I really
            miss a few of the ICU4J routines, like:</span></div>
        <div>
          
          
          
          
          
          
          <p>
            
            
            
            
            
            </p>
          <ul>
            <li><font face="arial, helvetica,
                sans-serif">char c1 = UTF16.getLeadSurrogate(codePoint);</font></li>
            <li><font face="arial, helvetica,
                sans-serif">char c2 = UTF16.getLeadSurrogate(codePoint);</font></li>
            <li><font face="arial, helvetica,
                sans-serif">String s = UTF16.valueOf(codePoint);</font></li>
          </ul>
          <p><font face="arial,
              helvetica, sans-serif"><span style="font-size:small">You can do them in plain Java,
                as in the above expression, but they&#39;re awkward and not
                as clear to read. And instead of the third one, the best
                I see in plain Java is the following, which is really
                pretty ugly (is there any better way?).</span></font></p>
          <p><font face="arial,
              helvetica, sans-serif"><span style="font-size:small"><br>
              </span></font></p>
          <p><font face="arial,
              helvetica, sans-serif"><span style="font-size:small">
                
                
                
                
                
                </span></font></p>
          <p><font face="arial,
              helvetica, sans-serif">String s = <span>new</span>
              <span>StringBuilder</span>().appendCodePoint(codePoint).toString();</font></p>
          <p><font face="arial,
              helvetica, sans-serif"><span style="font-size:small"><br>
              </span></font></p>
          <p><font face="arial,
              helvetica, sans-serif"><span style="font-size:small"></span><span style="font-size:small">Mark</span></font></p>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div>

</blockquote></div><br></div>