Java and Win-1251 encoding?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Rokamp

    Java and Win-1251 encoding?

    Hi!

    I'm testing a russian webpage with HttpUnit, but it seems, that it doesn't
    support the encoding (Win-1251).
    How can I add support for this in Java or HttpUnit?

    java.io.Unsuppo rtedEncodingExc eption: WIN-1251
    at sun.io.Converte rs.getConverter Class(Converter s.java:114)
    at sun.io.Converte rs.newConverter (Converters.jav a:145)
    at
    sun.io.ByteToCh arConverter.get Converter(ByteT oCharConverter. java:64)
    at java.lang.Strin gCoding.decode( StringCoding.ja va:216)
    at java.lang.Strin g.<init>(String .java:331)
    at java.lang.Strin g.<init>(String .java:359)
    at
    com.meterware.h ttpunit.WebResp onse.loadRespon seText(WebRespo nse.java:751)
    at
    com.meterware.h ttpunit.HttpWeb Response.<init> (HttpWebRespons e.java:58)
    at
    com.meterware.h ttpunit.WebConv ersation.newRes ponse(WebConver sation.java:66)
    at com.meterware.h ttpunit.WebClie nt.getResource( WebClient.java: 101)
    at com.meterware.h ttpunit.WebClie nt.getResponse( WebClient.java: 82)
    at SubmitTest.test MyTest(SubmitTe st.java:46)
    at sun.reflect.Nat iveMethodAccess orImpl.invoke0( Native Method)
    at
    sun.reflect.Nat iveMethodAccess orImpl.invoke(N ativeMethodAcce ssorImpl.java:3 9
    )
    at
    sun.reflect.Del egatingMethodAc cessorImpl.invo ke(DelegatingMe thodAccessorImp l
    ..java:25)
    at java.lang.refle ct.Method.invok e(Method.java:3 24)
    at junit.framework .TestCase.runTe st(TestCase.jav a:154)
    at junit.framework .TestCase.runBa re(TestCase.jav a:127)
    at junit.framework .TestResult$1.p rotect(TestResu lt.java:106)
    at junit.framework .TestResult.run Protected(TestR esult.java:124)
    at junit.framework .TestResult.run (TestResult.jav a:109)
    at junit.framework .TestCase.run(T estCase.java:11 8)
    at junit.framework .TestSuite.runT est(TestSuite.j ava:208)
    at junit.framework .TestSuite.run( TestSuite.java: 203)
    at junit.textui.Te stRunner.doRun( TestRunner.java :116)
    at junit.textui.Te stRunner.doRun( TestRunner.java :109)
    at junit.textui.Te stRunner.run(Te stRunner.java:7 2)
    at SubmitTest.main (SubmitTest.jav a:24)



  • Paul Gorodyansky

    #2
    Re: Java and Win-1251 encoding?

    Hi,

    "Thomas Rokamp" <nospam@crax.dk > wrote in message news:<3f2f91a7$ 0$32460$edfadb0 f@dread16.news. tele.dk>...[color=blue]
    > Hi!
    >
    > I'm testing a russian webpage with HttpUnit, but it seems, that it doesn't
    > support the encoding (Win-1251).
    > How can I add support for this in Java or HttpUnit?
    >
    > java.io.Unsuppo rtedEncodingExc eption: WIN-1251[/color]

    There is no such encoding name as "WIN-1251":

    - official IANA name used in XML ("encoding=..." ),
    in HTML and JSP ("charset=.. .") is
    "windows-1251"

    - internally in Java code, for example as encoding name parameter
    while doing conversion
    Unicode Java String <---> non-Unicode Byte Array
    it is "Cp1251" - see here:



    --
    Regards,
    Paul Gorodyansky
    "Cyrillic (Russian): instructions for Windows and Internet":

    Comment

    Working...