Author Topic: How to distinguish between Chinese English?  (Read 2770 times)

0 Members and 1 Guest are viewing this topic.

Q1241274614

  • Guest
How to distinguish between Chinese English?
« on: February 22, 2014, 10:59:59 AM »
How to distinguish between Chinese English?

“china”  “中国”

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: How to distinguish between Chinese English?
« Reply #1 on: February 22, 2014, 12:34:18 PM »
I do not know the answer, this my first try:

Comando: (eq "中" (chr (ascii "中")))
nil

Comando: (eq "C" (chr (ascii "C")))
T

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: How to distinguish between Chinese English?
« Reply #2 on: February 22, 2014, 01:22:11 PM »
How about this;

Code: [Select]
(getvar 'locale)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to distinguish between Chinese English?
« Reply #3 on: February 22, 2014, 05:27:39 PM »
Command: (ver)
"Visual LISP 2006 (en)"
I've reached the age where the happy hour is a nap. (°Ώ°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: How to distinguish between Chinese English?
« Reply #4 on: February 22, 2014, 05:44:20 PM »
Also:
Code: [Select]
(getvar 'syscodepage)

chlh_jd

  • Guest
Re: How to distinguish between Chinese English?
« Reply #5 on: February 22, 2014, 11:26:56 PM »
I don't know what you want .
If you want to get local computer use language , you can use Snownut2's suggest , If you want to split chinese and english , you must use other method . A Chinese characters require two bytes to store, and one letter only one byte, so you can't get a CHS Char by function ascii . However you can use the function vl-string->list , e.g.
Code: [Select]
(vl-string->list "中") --> (214 208)

Q1241274614

  • Guest
Re: How to distinguish between Chinese English?
« Reply #6 on: February 22, 2014, 11:30:27 PM »
"2014中国的bell"-->"2"  "1"  "0" "4"  "中"  "国"  "的" "b"  "e"  "l"  "l"

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: How to distinguish between Chinese English?
« Reply #7 on: February 23, 2014, 05:11:20 AM »
This?
Code - Auto/Visual Lisp: [Select]
  1. (defun f ( s )
  2.     (if (/= "" s)
  3.         (if (= 0 (vl-string-search "\\U+" s))
  4.             (cons (substr s 1 7) (f (substr s 8)))
  5.             (cons (substr s 1 1) (f (substr s 2)))
  6.         )
  7.     )
  8. )
Code: [Select]
(f "2014中国的bell")
("2" "0" "1" "4" "中" "国" "的" "b" "e" "l" "l")

chlh_jd

  • Guest
Re: How to distinguish between Chinese English?
« Reply #8 on: February 23, 2014, 08:46:13 AM »
my version
Code: [Select]
(defun f  (str / l a b r)
  (setq l (vl-string->list str))
  (while l
    (setq a (car l)
  l (cdr l))
    (if (< 128 a 255)
      (setq b (list a (car l))
    l (cdr l))
      (setq b (list a)))
    (setq r (cons b r)))
  (reverse (mapcar (function vl-list->string) r)))

chlh_jd

  • Guest
Re: How to distinguish between Chinese English?
« Reply #9 on: February 23, 2014, 08:48:43 AM »
Nice code Lee Mac  :-)
However , yours use Unicode to find Bigfont , it must used in ACAD2007 or Higher version .

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: How to distinguish between Chinese English?
« Reply #10 on: February 23, 2014, 09:16:11 AM »
Nice code Lee Mac  :-)
However , yours use Unicode to find Bigfont , it must used in ACAD2007 or Higher version .

Thanks chlh_jd - I wasn't aware of this restriction.

chlh_jd

  • Guest
Re: How to distinguish between Chinese English?
« Reply #11 on: February 23, 2014, 09:45:11 AM »
You're welcome , Lee  :-)

In ACAD2011 help page "在国际范围内共享图形文件"  -- Share Graphic file  at the international level (I translated) form say it .

When I convert the shx font into sharp by old soft , I found it can't not be compiled by ACAD2011's command 'complie' ;
And a  dwg in ACAD2011 save as ACAD2006 , Special symbols defined with \U+####  can not recognized, even though both have the same shx font files .
I think this is the reason .