Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: Need help: Linux, Java & BG problem


  • Subject: Re: lug-bg: Need help: Linux, Java & BG problem
  • From: yth@xxxxxxxxxxxx (Emilian Abadjiev)
  • Date: Wed, 22 Jan 2003 20:31:00 +0200

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<head>
  <meta http-equiv="Content-Type"
 content="text/html;charset=windows-1251">
  <title></title>
</head>
<body>
Emilian Abadjiev wrote:
<blockquote type="cite" cite="mid3E2ED89D.7040902@xxxxxxxxxxxx">
  <title></title>
George Danchev wrote:
  <blockquote type="cite" cite="mid200301221800.55409.danchev@xxxxxxxxx">
    <pre wrap="">On 22 01 2003 16:19, Kliment Ognianov wrote:
  
    <blockquote type="cite">
      <pre wrap="">Emilian Abadjiev wrote:
    
      <blockquote type="cite">
        <pre wrap="">Dori da inicializiraneto na String-a ot Unicode na CP1251, to pri
kompilirane Java-ta 6te syzdade edin i sy6ti rezultaten class tyj kato
wytre6no si pazi String-owete w UCS-2.

Kak moga da smenia encoding-a w titlebar-a?
      
      </blockquote>
    </blockquote>
    <pre wrap=""><!---->
ïðîáëåìà ñ áúëãàðèöàòà å â JVM-òî ìàé èëè ãðàôè÷íèòå áèáëèîòåêè, êàæè êîå JVM 
ïîëçâàø äà èíòåðïðåòâà áàéòêîäåòî (èëè êîìïèëàòîð ïîëçâàø?). Êàëîÿí Äîãàíîâ 
ìîæå äà ïîìîãíå çà òîâà êàê ðàáîòè <a class="moz-txt-link-freetext"
 href="http://cyrcho.sf.net";>http://cyrcho.sf.net</a> íàïðèìåð... çà ïîâå÷å 
íåçíàì...
  
  </blockquote>
  <font color="#990000">Ïðîáâàë ñúì ñ ðàçëè÷íè JDK-òà âêëþ÷èòåëíî
Sun-ñêèòå 1.3.1, 1.4 i 1.4.1 è IBM-ñêèòå 1.3 è 1.4.</font>
  <blockquote type="cite" cite="mid200301221800.55409.danchev@xxxxxxxxx">
    <pre wrap="">  
    <blockquote type="cite">
      <pre wrap="">Nnnne znam, tuk smenih Unicode codes s normalni si kirilishki bukvi i
    
    </blockquote>
    <pre wrap=""><!---->
åïà Unicode ïîääúðæà âñè÷êè èçâåñòíè íè àçáóêè â ðàìêèòå íà íàøàòà Ãàëàêòèêà 
âêë. è âñè÷êè êèðèëñêè àçáóêè ñå âìåñòâàò â íåãî è ïàê èìà ìÿñòî äà àäðåñèðà 
îùå òàêèâà ...

  
    <blockquote type="cite">
      <pre wrap="">sraboti .... ne vqrvam da e ot tipa na OSa: FreeBSD
    
    </blockquote>
    <pre wrap=""><!---->
ñúùèÿ ïðîáëåì òðåáå äà èìàø è òè êîìøî àêî ñè ñ Sun Java 2 version =< 1.4 
;-).... ÿ êàæè êîå JVM (ïðîèçâîäèòåë è òî÷íà âåðñèÿ) ïîëçâàø íà FreeBSD 
(íàòèâíî ëè å?), ÷å ñêîðî èìàøå èäåÿ çà FreeBSD native òàêàâà îò JavaSoft ìàé 
... 
  
  </blockquote>
  <font color="#990000">Íàèñòèíà ñðàáîòâà àêî òåõòà å â CP1251, íî ïúê
ñå ïðåöàêâà åòèêåòà (JLabel). Òîâà å òàêà, çàùîòî êàòî ñå êîìïèëèðà ñ:
   <b><tt>javac TestFrame.java</tt></b> èëè <b><tt>javac -encoding
ISO-8859-1 TestFrame.java</tt></b> ñå ïðåöàêâàò ñòðèíãîâåòå â CP1251, àêî
ñå êîìïèëèðà ñ ïðàâèëíèÿò ïàðàìåòúð (<b><tt>-encoding CP1251</tt></b>)
ñå ïîëó÷àâàò ñúùèòå "?????????" â titlebar-a. Ïîíåæå Java-òà å ñúñ
çàòâîðåí êîä, ìíîãî ìè ñå èñêà äà ìîãà äà ïèïíà íÿêúäå window's titlebar
encoding-a ïîä Ëèíóêñ è íåùàòà äà ñè äîéäàò íà ìÿñòîòî.</font> </blockquote>
Íàïðàâèõ åäíà ìîäèôèêàöèÿ ïðåäèøíèÿò ïðèìåð íà áàçàòà íà ãîðíèòå
ðàçñúæäåíèÿ, êîÿòî ïîêàçâà "èñòèíñêà" êèðèëèöà â titlebar-a. Íà ìåí ìè
ñå âèæäà äîñòà "õàêåðñêî" è íå ìå ðàäâà, íî âñå ïàê å íÿêàêâî ðåøåíèå
çà ïîä Ëèíóêñ. Êàêòî ñå è î÷àêâàøå íå ñðàáîòè ñ IBM-ñêîòî JDK 1.4.
<blockquote><tt>
import javax.swing.JFrame;</tt>
  <tt>import javax.swing.JLabel;</tt>
  
  <tt>public class TestFrame {</tt>
  
  <tt>    static String title_1 = "ÀÁÂÃÄ";</tt>
  <tt>    static String title_2 = "\u0410\u0411\u0412\u0413\u0414";</tt>
  
  <tt>    public static void main(String[] args) throws Exception {</tt>
  <tt>        System.out.println(title_1 + " " + title_2);</tt>
  
  <tt>        JFrame frame = new JFrame();</tt>
  <tt>        frame.setTitle(fixTitle(title_1) + " " +
fixTitle(title_2));</tt>
  <tt>        frame.setSize(300, 100);</tt>
  <tt>        JLabel label = new JLabel(title_1 + " " + title_2);</tt>
  <tt>        frame.getContentPane().add(label);</tt>
  <tt>        frame.show();</tt>
  <tt>    }</tt>
  
  <tt>    public static String <b>fixTitle</b>(String title) {</tt>
  <tt>        String osName;</tt>
  
  <tt>        if ((osName = System.getProperty("os.name")) != null) {</tt>
  <tt>            if (osName.toLowerCase().indexOf("linux") != -1) {</tt>
  <tt>                try {</tt>
  <tt>                    return <font color="#990000">new
String(title.getBytes("CP1251"), "ISO-8859-1")</font>;</tt>
  <tt>                } catch (java.io.UnsupportedEncodingException e)
{}</tt>
  <tt>            }</tt>
  <tt>        }</tt>
  
  <tt>        return title;</tt>
  
  <tt>    }</tt>
  
  <tt>}</tt>
</blockquote>
</body>


============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.