function phutil_utf8_is_cjk()

in src/utils/utf8.php [339:385]


function phutil_utf8_is_cjk($string) {
  $codepoints = phutil_utf8v_codepoints($string);

  foreach ($codepoints as $codepoint) {
    // CJK Unified Ideographs
    if ($codepoint >= 0x4E00 && $codepoint <= 0x9FFF) {
      return true;
    }

    // CJK Unified Ideographs Extension A
    if ($codepoint >= 0x3400 && $codepoint <= 0x4DBF) {
      return true;
    }

    // CJK Unified Ideographs Extension B
    if ($codepoint >= 0x20000 && $codepoint <= 0x2A6DF) {
      return true;
    }

    // CJK Unified Ideographs Extension C
    if ($codepoint >= 0x2A700 && $codepoint <= 0x2B73F) {
      return true;
    }

    // CJK Unified Ideographs Extension D
    if ($codepoint >= 0x2B740 && $codepoint <= 0x2B81F) {
      return true;
    }

    // CJK Unified Ideographs Extension E
    if ($codepoint >= 0x2B820 && $codepoint <= 0x2CEAF) {
      return true;
    }

    // CJK Unified Ideographs Extension F
    if ($codepoint >= 0x2CEB0 && $codepoint <= 0x2EBEF) {
      return true;
    }

    // CJK Compatibility Ideographs
    if ($codepoint >= 0xF900 && $codepoint <= 0xFAFF) {
      return true;
    }
  }

  return false;
}