Cp-1251 utf-8 converting: problems with russian letters

Hello every one!
I have faced a major problem in cp-1251 to utf8 string convertion (in Windows):
String result2 = new String(result.getBytes("utf8"), Charset.forName("cp-1251"));Everything works fine, but there is a problem with russian letter И (10th letter in the alphabeth).
cp-1251 byte code of И is 200
The right byte code for И in utf-8 is : 208 152, but I recieve the byte code 208 63 for И. So there must be some mistake.
So, when i try to read this string, i face a problem with wrong utf-8 charset...
I tried this code on Debian, everything works fine.
I will be glad if you are capable of helping me.
Thank you.
Edited by: smikler on Sep 27, 2009 10:25 AM
Edited by: smikler on Sep 27, 2009 10:27 AM

Your code makes no sense.
You're taking a String and asking for it to be turned into a stream of bytes according to the UTF-8 character encoding. And then you're giving these bytes back and asking to have them interpreted back into characters using the CP-1251 character encoding. This is bound to fail, because the bytes aren't in CP-1251 - they're in UTF-8 as you requested.
The very concept of changing the character encoding of a String is meaningless. Strings in Java are represented in Unicode. It's only when you convert to and from bytes (using the two methods you've used) that you worry about encoding/decoding.
So, why not describe what you're actually trying to achieve?

Similar Messages

  • Get property from .ini with Russian letters

    Hi,
    I am trying to read properties from .ini file with Russian letters.
    When I do the regular process:
    FileInputStream readIni = new FileInputStream("russianProp.ini" );
    Properties iniProperties= new Properties();
    iniProperties.load(readIni);
    String theValue = iniProperties.getProperty("by");I get funny charachters.
    So I tried to use:
    String theValue  = new String(iniProperties.getProperty("by").getBytes("ISO-8859-1"),"UTF-8");A. what is the efficient of the last code?
    B. is there a better way to deal with Russian letters in Properties?
    Thank!

    Hi,
    Yes in java 6 there is a method which load the reader in addition to the load of the input stream method. I
    so you code would be using the InputStreamReader ( reading the stream of bytes and convert them into the required character as instructed by the charset)
    FileInputStream fis = new FileInputStream("russianProp.ini");
              //For top efficiency, consider wrapping an InputStreamReader
              //within a BufferedReader so as to avoid frequent converter invocations
              BufferedReader isr
                 = new BufferedReader(new InputStreamReader(fis,"Cp866"));
              Properties iniProperties= new Properties();
              iniProperties.load(isr);Regards,
    Alan Mehio
    London,UK
    Edited by: alan_mehio on 28-Aug-2008 10:18

  • Has anyone had a problem with the letters literally rubbing off the keyboard?

    Has anyone had a problem with the letters actually disappearing from the keybord, like being gradually rubbed out? My macbook air had this problem one year after purchase. They fixed it for free. Now, a year later, I have the same prob. Apple doesnt want to know.
    I would be delighted with any suggestions, reactions etc. thanks in advance.

    I don't have to be doing anything or be anywhere near the computer.
    The machine feels warm but i don't know if thats normal or not.
    Imac, 20-inch,mid 2007
    Processor 2 GB  intel core 2 Duo
    Memory 2 GB 667 MHz DDR2 SDRAM
    Graphics ATI Radeon HD 2400 XT 128 MB
    Software OS X 10.8.2 (12C54)
    No third party extensions that Iknow of

  • Problem with Russian characters in Firefox on Mac OS X 10.5

    Hi everybody,
    I installed the latest version of Firefox (2.0.0.9) on Mac OS X 10.5(Leopard) on my iMac (Core 2 Duo, 2.16GHz). Now when I change the language option to Russian (in Mac OSX) and type in Firefox search box (in the top right corner) I see only question marks ("????") instead of russian characters. The same happens when I open Google page in the browser and type there. Also if I bookmark a web page that contains russian character in the title, it also have "????..." instead.
    However on some web pages, where I need to provide input the russian letters do show up. Also it works fine in Safari.
    I didn't have this kind of issue on previous versions of Mac OSX (Tiger) and Firefox. When I installed Firefox there everything just worked fine and I didn't have to change any settings. I still have my bootable drive with this configuration and when I run it everything is fine. I tried to compare language settings and Firefox preferences and character encoding settings in Tiger and Leopard, but I don't see any difference.
    I played with character encoding settings in Firefox, but that didn't fix the problem. Is it the problem of Leopard? Does anybody have the same issue? Any help is appreciated.
    Thank you.
    - Dmitri

    I think this is a FireFox problem, you need to ask them to fix it and use another browser (or perhaps the Russian version of Firefox) in the meantime.
    http://discussions.apple.com/thread.jspa?messageID=5668950&#5668950

  • Planning problems with russian language during refresh application

    Hello all ))
    I have problems with Planning during refresh my Application with Essbase.
    I intsalled Essbase on RHEL4 and set ESSLANG=Russian_Russia.ISO-8859-5@Default also I set locale on ru_RU.iso88595
    Ater that I installed Planning on Solaris 9 which uses Oracle RDBMS with NLS_CHARACTERSET=AL32UTF8 and set locale on server to ru_RU.iso88595
    Now I can create dementions, members on russion language in Essbase without problems also I can create dementions,members,etc on russian language in Planning. But if I create demention or member in Planning on Russian languge and ) try refresh my Application with Essbase I give follow error
    "=====(HspCubeCreation.java)sQueryString:?Application=Test1
    com.hyperion.planning.olap.EssbaseException: (1060010)
    at com.hyperion.planning.olap.HspEssbaseOutlineAPI.EssAddMemberEx(Native Method)
    at com.hyperion.planning.olap.HspCubeRefreshTask.addChildren(Unknown Source)
    at com.hyperion.planning.olap.HspCubeRefreshTask.addMembers(Unknown Source)
    at com.hyperion.planning.olap.HspCubeRefreshTask.addDimensionsAndMembers(Unknown Source)
    at com.hyperion.planning.olap.HspCubeRefreshTask.buildOutlines(Unknown Source)
    at com.hyperion.planning.olap.HspCubeRefreshTask.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)"
    Why it's happened?
    Please anybody help me

    since march 5 we are on planning 9.3.1.1 and also having problems with refreshing:
    com.hyperion.planning.HspCubeRefreshInProgressException: Cannot complete your request because the database is being refreshed.
         at com.hyperion.planning.HspJSImpl.lockApp(I)V(Unknown Source)
         at com.hyperion.planning.HyperionPlanningBean.lockApp()V(Unknown Source)
         at HspSecurityFilter.Handle(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(Unknown Source)
         at HspSecurityFilter.doPost(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3150)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    com.hyperion.planning.HspCubeRefreshInProgressException: Cannot complete your request because the database is being refreshed.
         at com.hyperion.planning.olap.HspCubeRefreshTask.run()V(Unknown Source)
         at java.lang.Thread.run()V(Unknown Source)
    anyone a idea?

  • Problems with Russian characters in BB Bridge

    Some time ago my contact list on BB 9800 was updated using Desktop software for Mac. Some of contacts were written in Russian. Same updates were made for MemoPad as well in the same manner. Everything was good on the smartphone side before I made an attempt to sync my phone with Playbook. Both sections refused to sync! After removing manually all contacts and memos with Russian font, the sync went normal again. There are a lot of problems with Playbook, which cost me my time and money. This was just one of them... Why not to say it clear - do not try to sync Russian characters?

    Same problem when I use Chinese.
    The only thing we can do now is to wait for an update! Which is hopefully make the Playbook worth something!

  • Problems with russian characters

    I need to localize my application to russian language and i have problems with their special characters. I use Graphics.drawString method and unicode escape sequences and this works fine on phones like SE, Nokia and Siemens. But some phones are not able to display these characters (Motorola, Sharp, Samsung). Do u know any other way how to draw these characters on problematic phones listed above?
    thanx for any hint

    thanx for hint, but i'm not familliar with this stuff in j2me. could u described it in more details, please?

  • Problem with russian tags in english version of iTunes.

    I'm using english language in MacOS:
    end when I adding music to iTunes with russian tags and names it make it look like this:
    but when I make russian as first language...
    it becomes ok:
    Question is: How to fix it, and listen russian music in iTunes with normal names and tags?
    Thank you.

    It may be you need to convert the tags to Unicode.  This app may help:
    http://www.macupdate.com/app/mac/15953/id3mod

  • Problems with croatian letters (CP1250)

    Hello.
    I have got a small problem with some characters in my application. I am working on Java Card tehonlogy with Gemplus GemXpresso 211PK tool (reader is GemPC410) and when I made an application in JBuilder 8 (I am using(I had to) JDK 1.2. not new 1.4.-> that they wrote in documentation) I try to run application but when application is running our Croatian characters are not shown (they are replaced vith rectangle) and I don't know what to do. I try with the java.util.Local package but it's not working and i try to change the code page in JBuilder on Cp1250 but stil nothing.
    I want to ask you if you can help me.
    Thank you very much.
    Bye,
    Mario.

    Haha, I understand most of the Sweedish language, but I never get the nickname you guys are using on us: "norrbagge"... I guesing it not excactly the same as "normann"?
    Setting locale in .bashrc did not solve my problems. Tried them all. 
    After putting <export LC_ALL="nb_NO.iso88591"> in .bashrc, the comand: "locale" gives me:
    in xterm:
    [kristian@localhost ~]$ locale
    LANG=nb_NO.UTF-8
    LC_CTYPE="nb_NO.iso88591"
    LC_NUMERIC="nb_NO.iso88591"
    LC_TIME="nb_NO.iso88591"
    LC_COLLATE="nb_NO.iso88591"
    LC_MONETARY="nb_NO.iso88591"
    LC_MESSAGES="nb_NO.iso88591"
    LC_PAPER="nb_NO.iso88591"
    LC_NAME="nb_NO.iso88591"
    LC_ADDRESS="nb_NO.iso88591"
    LC_TELEPHONE="nb_NO.iso88591"
    LC_MEASUREMENT="nb_NO.iso88591"
    LC_IDENTIFICATION="nb_NO.iso88591"
    LC_ALL=nb_NO.iso88591
    in aterm:
    [kristian@localhost ~]$ locale
    LANG=no_NO.ISO-8859-1
    LC_CTYPE="nb_NO.iso88591"
    LC_NUMERIC="nb_NO.iso88591"
    LC_TIME="nb_NO.iso88591"
    LC_COLLATE="nb_NO.iso88591"
    LC_MONETARY="nb_NO.iso88591"
    LC_MESSAGES="nb_NO.iso88591"
    LC_PAPER="nb_NO.iso88591"
    LC_NAME="nb_NO.iso88591"
    LC_ADDRESS="nb_NO.iso88591"
    LC_TELEPHONE="nb_NO.iso88591"
    LC_MEASUREMENT="nb_NO.iso88591"
    LC_IDENTIFICATION="nb_NO.iso88591"
    LC_ALL=nb_NO.iso88591]
    Why doesn't "LANG" match with the others? Where can I change it?
    The loadkeys-problem was because I forgot to run it as root :oops:  But it did not solve anything. 
    I got the Idea that aterm might be compiled without support for Norwegian letters, and tried to recompile it. Man that is easy to do with "abs"!! But it did not solve my problems  , or maybe I just tried the wrong flags. Tried --enable-greek --enable-big5 --enable-kanji, but all I got was som werid japanese(or something) letters. I reinstalled aterm from current.

  • Problems with special letters while export/import the application

    Hi all,
    I have a HTML DB with german letters in the labels and buttons. After the import of my application I have developed recently, alle the german letters are replaced with curious characters like ö instead of ö e.g.
    Do you know a solution for this problem?
    Thx!
    Michal

    Hi Michal,
    1) What is the version of HTML DB?
    2) What is your database character set?
    3) What does the configuration of your Database Access Descriptor look like?
    4) If HTML DB 2.0, have you applied the PL/SQL Web Tloolkit patch?
    Joel

  • Problems with norwegian letters when browsing samba share.

    When I'm browsing my samba share from my ArchLinux workstation, files in the share with norwegian letters are not shown correct. This applies both from aterm and konqueror.
    But if I use a Windows XP/2000 machine, everything is shown like it is suppose to do with norwegian letters.
    The samba server is also running ArchLinux. On my workstation I'm using Enlightenment as windowmanager.
    Is this a problem with my samba server or with my linux workstation? What can I do to fix it?
    [orjanp@ArchLinux ~]$ cat /etc/samba/smb.conf
    # Global parameters
    [global]
    workgroup = HJEMMENETT
    server string = Samba
    username map = /etc/samba/smbusers
    log file = /var/log/samba.%m
    max log size = 50
    dns proxy = No
    printer admin = root
    load printers = yes
    use client driver = Yes
    display charset = ISO-8859-1
    dos charset = 850
    [homes]
    comment = Home Directories
    read only = No
    browseable = No
    [Media]
    path = /mnt/media
    browseable = yes
    write list = orjanp
    [Software]
    path = /mnt/progs
    browseable = yes
    write list = orjanp
    [Bacup]
    path = /mnt/bacup
    read list = orjanp
    write list = orjanp
    browseable = No
    [HP750]
    comment = Samba shared printer
    path = /var/spool/samba
    read only = No
    guest ok = Yes
    printable = Yes
    printer name = HP750
    use client driver = yes
    oplocks = No
    share modes = No

    It seems like it's not only the ArchLinux workstation that displays the norwegian letters wrong. The only machine that shows this correc is the machine that created the file/catalogue.
    It seems like the windows 2000 displays the cataloge created by windows XP just fine.

  • Problem with Russian translation

    Yesterday I took in to rent a movie "we Millers"! However, no Russian track. Just a silent movie!
    This is not the first time Same problems i'd have with "Machetto killes" movie
    . What's the matter?

    Welcome to the Apple Community.
    Select the content which is causing a problem and use the 'Report a problem' button in Your Purchase History on your computer.
    Currently, if your purchase happens to be your most recent purchase you will need to click the large ‘Report A Problem’ button under the list of previous purchases in order to reveal the ‘Report A Problem’ link for your recent purchase. If your purchase is listed as a previous purchase use the small arrow on the left side of its listing.
    Alternatively you can use the receipt email to report a problem.

  • JSF encoding problem with Russian

    Hi,
    I am new to JSF, trying to build prototype i18n JSF app with MyFaces 1.1.5
    Mostly care about IE6/7, do not officially support other browsers.
    I do have resource bundles, it is localized and internationalized.
    So user is supposed to work in either English or Russian.
    It all works except a few issues:
    1) When user enters something in Russian in inputText field on the first page,
    trying to pass it to the next page via managed bean.
    But instead of showing it in Russian, it shows some garbled text in outputText or outputLabel: Îëåã
    FF3 & Chrome show it as: &#1054;&#1083;&#1077;&#1075; [&#xxxx, where xxxx us a 4 digits]
    It does pick up labels from correct bundle on the next page, so locale is changed correctly.
    Actually, when I switch locale on the same first page, getting the same problem (after it's refreshed).
    Seems to work OK with Spanish
    Is that incorrect Cyrillic encoding, JSF encoding or broken Unicode or locale?
    How can we fix that ?
    Less important issues:
    2) When we switch locale (correct values in bundles), on the screen it can not change currencyCode, currencySymbol, TimeZone,
    it always shows the first one it picked, although dateTime and Number formatting changes correctly;
    3) In IE6 "alt" tag attribute produces garbled characters in Russian (black vertical squares), looks like IE6 bug; FF3 & Chrome work fine.
    Please help !
    TIA,
    Oleg.

    For 1, you are not passing the characters in the correct encoding from one page to the next when you pass the parameter (most likely).

  • Converting problems with QT file!

    I have a few Quicktime MOV files that I want to send a friend who owns a PC. The problem is - he gets audio but NO video (black screen) when he tries to play or convert these files with any of his software. I tried to convert the file on my Mac using Xilisoft Video Convertor, but I have the same results when I try to convert the files to Divx, AVI, MP4 or any other format. I can ONLY see the video when I play the original MOV file in Quicktime. Any suggestions?

    an H264 exported from QT is a safe way to go for windows play back-its a daily occurance here
    file >export >quicktime movie > H264

  • Problems with Russian, Ukrainian etc. characters in Polish InDesign CS4

    Hi everyone,
    I'm a new user of InDesign CS4 (Polish version). Mostly i'm using Garamond Pro for setting text -- there is no Russian characters. Who know which one font has Russian, Ukrinian, Bulgarian Oldslavic etc. characters?
    thanks in advance!
    Maks

    If you're using Windows, there is an incredibly useful utility Babelmap that has the tool you need: "List all the fonts installed on my system that support the text I have on my clipboard". I used to use it all the time.
    I very much doubt that you have many fonts already installed on your system that support Old Slavic, unless you've installed them yourself. Bulgarian coverage is better, but still not common. If you'd like I can post some links to the pages where links to the type foundries working in these scripts are often posted. If you're not already familiar with it, Paratype is probably going to be your first stop.

Maybe you are looking for

  • Using IMAC 27 (LATE 2009 ) as primary display for MAC PRO PRO 2013

    I have been a user of IMAC & Macbook but not mac PRO. I wish to upgrade to  MAC PRO ( 2013 ). As i want to make the transition less costly i want to use my current IMAC 27in ( LATE 2009 ) as the one and only display. First question . Is the above pos

  • Error in allocating RG23D document number Interval not found Number object

    Dear Expert Error in allocating RG23D document number Interval not found Number object J_1IRG23D I tried the solution given in the forum but its not working, Pls help me out. Thanks and Regards Deepankar

  • Archive Logs Will Not Delete from OS

    Hi Everyone, Here's my issue. Somehow i have a few archivelogs that are corruptued, plus a backup of the database that is corrupted. Since then, I have made a new backup of the database and everything is running smoothly. WHen i try to delete the fil

  • Foreach output from get-command, add menu item

    Hi I'm making a script to configure some basic settings for new servers, and one of the features in the script is to set ip-address on the network interface.  At some servers there are several network interfaces, and I would like to create a menu bas

  • Where has my search bar gone?

    Since 20mins ago my search bar has disappeared in Safari! I now only have an address bar? I have tried to customise and also ~/library/preferences/ as described in one of the other posts but to no avail. How frustrating!