Character encoding and Sybase JDBC driver

Hi,
I have an issue with the Sybase JDBC driver we are using. We have characters in our database, e.g., canon with a ~ over the n. When I do a getString from the ResultSet, I see a ? instead of the character. I'm specifying utf8 as the encoding in the properties in the WLS console. I tried utf16 or ucs2, but I got exceptions from the Sybase JDBC driver at start up.
Any help would be greatly appreciated.

Pat Bumpus wrote:
Hi,
I have an issue with the Sybase JDBC driver we are using. We have characters in our database, e.g., canon with a ~ over the n. When I do a getString from the ResultSet, I see a ? instead of the character. I'm specifying utf8 as the encoding in the properties in the WLS console. I tried utf16 or ucs2, but I got exceptions from the Sybase JDBC driver at start up.
Any help would be greatly appreciated.Which Sybase driver are you using?
Joe

Similar Messages

  • Sybase JDBC driver & Invalid column name error

    I submitted a note a year ago concerning JDBC-ODBC bridge and SQL Server db. Same Invalid column name error. The resolution was a bug in the XSU code.
    This time the error is with a jconnect5 JDBC driver from Sybase to a Sybase ASA db. ASA is Adaptive Server Anywhere.
    <ERROR xsql-timing="140">oracle.xml.sql.OracleXMLSQLException: S0022: Invalid column name 'name'.</ERROR>
    However if I use a Sybase JDBC driver from INet Software of Germany, I get the desired result of my query.
    Below are sample XSQLConfig.xml definitions.
    INet Software Sybase JDBC driver definition:
    - <connection name="deasa">
    <username>dba</username>
    <password>sql</password>
    <dburl>jdbc:inetsyb:LEMKAU:2638?database=asademo</dburl>
    <driver>com.inet.syb.SybDriver</driver>
    <autocommit>true</autocommit>
    </connection>
    Sybase jconnect5 Sybase JDBC driver definition:
    - <connection name="asa">
    <username>dba</username>
    <password>sql</password>
    <dburl>jdbc:sybase:Tds:lemkau:2638?ServiceName=asademo</dburl>
    <driver>com.sybase.jdbc.SybDriver</driver>
    <autocommit>true</autocommit>
    </connection>
    I believe the bug has to do with the numeric codes that the drivers use to determine data types are not properly interpreted.
    See XML General note title "insert-request, xsu 2.1.0 beta & SQL Server" for reference.
    Steve.

    Thanks for the notification. We will look into this issue...

  • [Sybase JDBC Driver]Object has been closed

    Hi,
    I am getting the following error when accessing a datasource in an EJB on Weblogic using the Data Direct Drivers.
    java.sql.SQLException: [DataDirect][Sybase JDBC Driver]Object has been closed.
    The code works every other time. the first time through it works the second time I get the error.
    Any insite would be appricated.
    Here is my code
    public String test(String id)
    System.out.println ("test1");
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement stmt = null;
    PreparedStatement stmt2 = null;
    String ret = "?????";
    try
    System.out.println ("read data - prepare");
    InitialContext ic = new InitialContext();
    ds = (DataSource)ic.lookup("java:comp/env/jdbc/dataconn");
    conn = ds.getConnection();
    String sql = "SELECT * FROM myTable WHERE ID = ?";
    System.out.println ("read data - conn.prepareStatement(sql);");
    stmt = conn.prepareStatement(sql);
    stmt.setString(1, id);
    // stmt.setMaxRows(1000);
    System.out.println ("read data - stmt.executeQuery();");
    ResultSet rs = stmt.executeQuery();
    System.out.println ("read data - read");
    if(!rs.next())
    ret = "Not found";
    else
    ret = "found";
    sql = "UPDATE myTable SET column1 = column1 + 1 WHERE ID = ?";
    System.out.println ("update data - prepare");
    stmt2 = conn.prepareStatement(sql);
    stmt2.setString(1, id);
    ret = ret + stmt2.executeUpdate();
    System.out.println ("update data - update");
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    stmt.close();
    catch(Exception exception1) { }
    try
    stmt2.close();
    catch(Exception exception1) { }
    try
    conn.close();
    catch(Exception exception1) { }
    stmt = null;
    stmt2 = null;
    conn = null;
    return ret;
    }

    Hi. What version of weblogic, and can you print the whole stacktrace?
    That way I'll know which object is already closed. This hints at an
    already-fixed bug, but I'm not sure yet... And tell me what happens
    if you close your result set after you do your call to next(). Lastly,
    you can save some DBMS traffic if you change the query to:
    "SELECT 1 FROM myTable WHERE ID = ?"
    Then regardless of how wide the table is, and whether the table data
    is in DBMS memory, as long as there's an index on ID, the query only
    needs to use the index, not the data page to answer. If there's an
    index entry for your ID value, you'll get one row with 1 in it, else
    nothing.
    thanks
    Joe
    Scot McReynolds wrote:
    Hi,
    I am getting the following error when accessing a datasource in an EJB on Weblogic using the Data Direct Drivers.
    java.sql.SQLException: [DataDirect][Sybase JDBC Driver]Object has been closed.
    The code works every other time. the first time through it works the second time I get the error.
    Any insite would be appricated.
    Here is my code
    public String test(String id)
    System.out.println ("test1");
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement stmt = null;
    PreparedStatement stmt2 = null;
    String ret = "?????";
    try
    System.out.println ("read data - prepare");
    InitialContext ic = new InitialContext();
    ds = (DataSource)ic.lookup("java:comp/env/jdbc/dataconn");
    conn = ds.getConnection();
    String sql = "SELECT * FROM myTable WHERE ID = ?";
    System.out.println ("read data - conn.prepareStatement(sql);");
    stmt = conn.prepareStatement(sql);
    stmt.setString(1, id);
    // stmt.setMaxRows(1000);
    System.out.println ("read data - stmt.executeQuery();");
    ResultSet rs = stmt.executeQuery();
    System.out.println ("read data - read");
    if(!rs.next())
    ret = "Not found";
    else
    ret = "found";
    sql = "UPDATE myTable SET column1 = column1 + 1 WHERE ID = ?";
    System.out.println ("update data - prepare");
    stmt2 = conn.prepareStatement(sql);
    stmt2.setString(1, id);
    ret = ret + stmt2.executeUpdate();
    System.out.println ("update data - update");
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    stmt.close();
    catch(Exception exception1) { }
    try
    stmt2.close();
    catch(Exception exception1) { }
    try
    conn.close();
    catch(Exception exception1) { }
    stmt = null;
    stmt2 = null;
    conn = null;
    return ret;

  • Error oracle.sql.* and oracle.jdbc.driver.* not found when using oracle as a database

    I am using oracle as database and weblogic 4.5. I have copied the classes12.zip file in lib directory of weblogic. I am getting the error that oracle.sql.* and oracle.jdbc.driver.* not found when i am importing these packages in a jsp file. what i need to do to import oracle driver packages?I put it in the classpath also.
    Please Advice!
    Thanks in advance
    AnuPama

    Hi Anupama,
    First of all I would be surprised if you would not like to use the connection pooling feature of weblogic (in which case you might not be needing the import the classes directly), and would like to open direct connections to your database. Anyways for doing that I would recommend you to check out the readme doc that ships
    along with the jdbc oracle (classes12.zip etc). I am giving an excerpt over here:
    These are a few simple things that you should do in your JDBC program:
    1. Import the necessary JDBC classes in your programs that use JDBC.
    For example:
    import java.sql.*;
    import java.math.*;
    2. Register the Oracle driver before before calling other JDBC APIs.
    (This is not needed if you are using the JDBC Server-side Internal
    Driver because registration is done automatically in the server.)
    To register the Oracle driver, make sure the following statement
    is executed at least once in your Java session:
    DriverManager.registerDriver(
    new oracle.jdbc.driver.OracleDriver());
    3. Open a connection to the database with the getConnection call.
    Different connection URLs should be used for different JDBC
    drivers. The following examples demonstrate the different URLs.
    For the JDBC OCI8 Driver:
    Connection conn = DriverManager.getConnection(
    "jdbc:oracle:oci8:@<database>",
    "scott", "tiger");
    where <database> is either an entry in tnsnames.ora or a SQL*net
    name-value pair.
    For the JDBC Thin Driver, or Server-side Thin Driver:
    Connection conn = DriverManager.getConnection(
    "jdbc:oracle:thin:@<database>",
    "scott", "tiger");
    where <database> is either a string of the form
    <host>:<port>:<sid> or a SQL*net name-value pair.
    For the JDBC Server-side Internal Driver:
    Connection conn = DriverManager.getConnection(
    "jdbc:oracle:kprb:");
    Note that the trailing ':' character is necessary. When you use
    the Server-side Internal Driver, you always connect to the
    database you are executing in. You can also do this:
    Connection conn
    = new oracle.jdbc.driver.OracleDriver().defaultConnection();
    Hope this helps,
    Thanks,
    Anupama wrote:
    I am using oracle as database and weblogic 4.5. I have copied the classes12.zip file in lib directory of weblogic. I am getting the error that oracle.sql.* and oracle.jdbc.driver.* not found when i am importing these packages in a jsp file. what i need to do to import oracle driver packages?I put it in the classpath also.
    Please Advice!
    Thanks in advance
    AnuPama--
    Apurb Kumar

  • CachedRowSet with sybase JDBC driver

    In previous postings you mentioned the solution to using CachedRowSets with Sybase
    JDBC involves setting certain properties. My question is WHERE and WHEN do you
    set these properties?

    Peter Wu wrote:
    Hello,
    Does anyone know if there is any way to use CachedRowSet with sybase JDBC
    driver?
    I knew there was posting regarding this in the year 2000. And now it 2003. Thanks!
    PeterYes there is, but it involves some driver-specific properties, and I know this from
    a discussion I read on their jdbc support newsgroup. That would be the best place
    for an answer about their driver. Try news://forums.sybase.com, in the sybase.public.jconnect50
    group.
    Joe

  • Using CachedRowSet with sybase JDBC driver

    Hello,
    Does anyone know if there is any way to use CachedRowSet with sybase JDBC
    driver?
    I knew there was posting regarding this in the year 2000. And now it 2003. Thanks!
    Peter

    Peter Wu wrote:
    Hello,
    Does anyone know if there is any way to use CachedRowSet with sybase JDBC
    driver?
    I knew there was posting regarding this in the year 2000. And now it 2003. Thanks!
    PeterYes there is, but it involves some driver-specific properties, and I know this from
    a discussion I read on their jdbc support newsgroup. That would be the best place
    for an answer about their driver. Try news://forums.sybase.com, in the sybase.public.jconnect50
    group.
    Joe

  • Sybase JDBC driver

    Hi,
    We have recently upgraded our weblogic server from 6.0 to 6.1 sp5 on our testing
    environment.
    Our application runs fine for a few hours until our sybase db shuts down for some
    reason. Thus rendering all connections to the db to fail.
    Anyone know if the current JDBC driver has any comptiability issues with weblogic
    6.1 sp5. Current version is "jConnect (TM) for JDBC(TM)/5.2(Build 21136)/P/EBF9747/JDK12/"
    Our application connects to the db via a connection pool.
    Here's the current settings for the connection pool:
    <JDBCConnectionPool CapacityIncrement="10"
    DriverName="com.sybase.jdbc2.jdbc.SybDriver" InitialCapacity="1"
    MaxCapacity="200" Name="biaSybaseConnectionPool"
    Properties="user=XXXXX;password=XXXXX" RefreshMinutes="0"
    ShrinkPeriodMinutes="10" ShrinkingEnabled="true" Targets="as1"
    TestConnectionsOnRelease="true" TestConnectionsOnReserve="true"
    TestTableName="systypes" URL="jdbc:sybase:Tds:x.x.x.x:xxxx"/>
    Here's some error log from weblgoic:
    java.sql.SQLException: weblogic.common.ConnectDeadException: failed to make new
    pool connection: java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings
    chained to this exception for the reason(s).
    weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to
    this exception for the reason(s).
    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:480)
    at com.sybase.jdbc2.tds.Tds.processLoginAckToken(Tds.java:2938)
    at com.sybase.jdbc2.tds.Tds.doLogin(Tds.java:419)
    at com.sybase.jdbc2.tds.Tds.login(Tds.java:341)
    Thanks for your help
    Regards,
    Raymond

    R Fung wrote:
    Hi,
    We have recently upgraded our weblogic server from 6.0 to 6.1 sp5 on our testing
    environment.
    Our application runs fine for a few hours until our sybase db shuts down for some
    reason. Thus rendering all connections to the db to fail.
    Anyone know if the current JDBC driver has any comptiability issues with weblogic
    6.1 sp5. Current version is "jConnect (TM) for JDBC(TM)/5.2(Build 21136)/P/EBF9747/JDK12/"
    Our application connects to the db via a connection pool.
    Here's the current settings for the connection pool:
    <JDBCConnectionPool CapacityIncrement="10"
    DriverName="com.sybase.jdbc2.jdbc.SybDriver" InitialCapacity="1"
    MaxCapacity="200" Name="biaSybaseConnectionPool"
    Properties="user=XXXXX;password=XXXXX" RefreshMinutes="0"
    ShrinkPeriodMinutes="10" ShrinkingEnabled="true" Targets="as1"
    TestConnectionsOnRelease="true" TestConnectionsOnReserve="true"
    TestTableName="systypes" URL="jdbc:sybase:Tds:x.x.x.x:xxxx"/>Hi. A few things: I would set the initial capacity = max capacity = 50 or less.
    I would set TestConnectionsOnRelease="false".
    See below for more....
    Here's some error log from weblgoic:
    java.sql.SQLException: weblogic.common.ConnectDeadException: failed to make new
    pool connection: java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings
    chained to this exception for the reason(s).
    *******************************************I would expect to see this sort of exception in the logs during the time the DBMS was
    down. Are you saying that the pool never recovers after the DBMS comes back up?
    Lastly, I recommend that you download Sybase's latest appropriate driver and get it ahead
    of weblogic stuff in the classpath the statup script builds for the server.
    Joe
    >
    weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to
    this exception for the reason(s).
    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:480)
    at com.sybase.jdbc2.tds.Tds.processLoginAckToken(Tds.java:2938)
    at com.sybase.jdbc2.tds.Tds.doLogin(Tds.java:419)
    at com.sybase.jdbc2.tds.Tds.login(Tds.java:341)
    Thanks for your help
    Regards,
    Raymond

  • PI 7.1 and Oracle JDBC driver: missing com.sap.aii.adapter.lib.sda

    Hello,
    I want to deploy the JDBC driver for Oracle databases as described in OSS 1138877 on a brand-new PI7.1 (SP06 Stack) installation. Unfortunately, I can't find com.sap.aii.adapter.lib.sda on the system, so I can't add the ojdbc14.jar file and deplay it using JSPM.
    Where can I get it from?
    Thank you and best regards,
    Herwig

    hey,
         The JDBC driver installation is different for PI 7.1.
    The dowload/modify/deploy .sap.aii.adapter.lib.sda method was used in the earlier versions.(mentioned in the How to guides)
    Look at the SAP documentation below -
    http://help.sap.com/saphelp_nwpi71/helpdata/en/cf/128a42f802a01ae10000000a155106/frameset.htm
    Arvind R

  • Why differing Character Encoding and how to fix it?

    I have PRS-950 and PRS-350 readers, both since 2011.  
    In the last year, I've been getting books with Character Encoding that is not easy to read.  In playing around with my browsers and View -> Encoding menus, I have figured out that it has something to do with the character encoding within the epub files.
    I buy books from several ebook stores and I borrow from the library.
    The problem may be the entire book, but it is usually restricted to a few chapters, with rare occasion where the encoding changes within a chapter.  Usually it is for a whole chapter, not part, and it can be seen in chapters not consecutive to each other.
    It occurs whether the book is downloaded directly to my 950 reader or if I load it to either reader from my computer(s), which are all Mac OS X of several versions fom 10.4 to Mountain Lion.  SInce it happens when the book is downloaded directly, I figure the operating system of my computer is not relevant.
    There are several publishers involved, though Baen (no DRM ebooks) has not so far been one of them.
    If I look at the books with viewers on the computer, the encoding is the same.  I've read them in Calibre, in the Sony Reader App, and in Adobe Digital Editions 2.0.  It's always the same.
    I believe the encoding is inherent to the files.  I would like to fix this if I can to make the books I've purchased, many of them in paper and electronically, more enjoyable to read on my readers.
    Example: I’ve is printed instead of I've.
    ’ for apostrophe
    “ the opening of a quotation,
    â€?  for closing the quotation,
    and I think — is for a hyphen.
    When a sentence had “’m  for " 'm at the beginning of a speech (when the character was slurring his words) it took me a while to figure out how it was supposed to read.
    “’Sides, â€™tis only for a moon.  That ain’t long.â€?
    was in one recent book.
    Translation: " 'Sides, 'tis only for a moon. That ain't long."
    See what I mean? 
    Any ideas?

    Hi
    I wonder if it’s possible to download a free ebook with such issue, in order to make some “tests”.
    Perhaps it’s possible, on free ebooks (without DRM), to add fonts by using softwares like Sigil.

  • How to deploy MS Sql Server 2005 and 2008 jdbc driver

    Hi SAP Guru's
    Can somebody tell me how to deploy the jdbc driver of MS SQL Server 2005 and 2008 on SDM.
    According to the SAP instruction we should have 3 files(mssqlserver.jar,msbase.jar,msutil.jar) but in 2005 driver file we only have 1 file i.e sqljdbc.jar so how do i deploy it .
    Secondly i cannot deploy it on visual administrator as well and when i am doing the File to jdbc scenarion i am getting this error
    " Accessing database connection "jdbc.sqlserver://localhost:1433;DatabaseName=Employee failed DriverManagerException. Cannot establish connection to URL jdbc.sqlserver://localhost:1433;DatabaseName=Employee  SAPClassNotFoundException com.microsoft.sqlserver.jdbc.SQLServerDriver".
    can somebody please upload the screen shots on mediafire or any other site so that i will solve my problem.

    Hello,
    *OS: First of all: *
    3 files (msbase.jar,mssqlserver.jar and msutility.jar )should be zipped to aii_af_jmsproviderlib.zip file only for UNIX OS.
    For Windows OS only sqljdbc.jar file which in every version of JDBC driver should be zipped to aii_af_jmsproviderlib.zip.
    You can deploy JDBC driver through SDM tool which mention in guide below:
    New version of JDBC driver installation guiade:
    External Driver Configuration for Process Integration 7.0
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60237e74-ef19-2b10-5a9b-b35cc6a28e83
    Drivertool from this guide you can find at https://www.sdn.sap.com/irj/sdn/howtoguides
    Then Exchange Infrastructure How-to Guides for SAP NetWeaver 2004 HYPERLINK "https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f04ce027-934d-2a10-5a8f-fa0b1ed4d88f"
    How to Install and Configure External Drivers for JDBC & JMS
    AdaptersHYPERLINK "https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e00262f5-934d-2a10-b99c-9bc63c2a7768"
    Download attached system files (ZIP 16KB)
    Any questions - let me know
    BR,
    Dzmitry

  • Dynamically loading and registering JDBC driver from an archive (zip - jar)

    I'm programming an JDBC driver tester.
    I have to load dynamically any driver from an archive (jar or zip) after the user uploaded it.
    I think i did it well with my ClassLoader, i can get an instance of the driver and use any method like (getMinorVersion()) but when i registering it fail.
    There is no error but the driver is not registered.
    I rode the DriverManager log (with his logwriter) and he says :
    skipping: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@5439fe]
    skipping: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@2b7db1]
    (two times, it looks curious isn't it ?)
    This is a part of my code :
    Driver pilote = (Driver)Class.forName(driverClass.getName(), true,this).newInstance();
    System.out.println("Minor Version = "+ pilote.getMinorVersion());
    PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(System.out));
    DriverManager.setLogWriter(printwriter);
    DriverManager.registerDriver(pilote);
    System.out.println("Driver registered\n");

    I have made a simple test :
    public static void main(String[] param)
    System.out.println("Loading Driver from JAR ...");
    try
    File jar = new File("c://mbm//drivers//oracle.jar");
    URL aurl[] = {jar.toURL()};
    URLClassLoader urlclassloader = new URLClassLoader(aurl, ClassLoader.getSystemClassLoader());
    Class.forName("oracle.jdbc.driver.OracleDriver", true, urlclassloader);
    PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(System.out));
    DriverManager.setLogWriter(printwriter);
    Enumeration listDriver = DriverManager.getDrivers();
    System.out.println("[---------Drivers-----------]");
    while (listDriver.hasMoreElements())
    Driver driver = (Driver) listDriver.nextElement();
    System.out.println("->> "+driver.getClass().getName());
    catch (MalformedURLException e)
    e.printStackTrace();
    catch (ClassNotFoundException e)
    e.printStackTrace();
    This displays that :
    Loading Driver from JAR ...
    skipping: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@9ec21d67]
    [---------Drivers-----------]
    D:\www\tomcat\webapps\mbm\WEB-INF\classes>
    I think there is in this case only one instance

  • UCCX8 and MySql JDBC Driver

    Hi,
    i tried to find a way to connect the UCCX8 with my MySql database. I got the MySql JDBC Driver but i can't install this on my UCCX8 server.
    I use UCCX 8.0.1. Is there any way to connect mysql with UCCX8? Supported or unsupported?
    Thanks for all...
    Christian

    If you check the compatibility Matrix here:
    http://www.cisco.com/en/US/docs/voice_ip_comm/cust_contact/contact_center/crs/express_compatibility/matrix/crscomtx.pdf
    MySQL is not listed as compatible. And so will not be supported...

  • 9iAS and Informix jdbc driver

    Hi,
    How do I configure 9iAS release 2 data source to access Informix database using Invformix JDBC driver? Has any one done it and can share the procedure?
    Sam

    Samir -
    I've not done this, but this is the general idea.
    btw - we ship the DataDirect JDBC drivers with 9iAS to facilitate connections to other databases such as DB2, SS, Informix, etc.
    What you want to do is:
    a) Take the JDBC library you wish to use and put it into the j2ee/home/lib directory (bounce the server since this directory is read at startup time and the classpath constructed. Dynamic additions are not picked up)
    b) Define an emulated datasource in the j2ee/home/config/data-sources.xml file using the driver class and specific URL connection string for the JDBC driver you want to use:
    <data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="InformixDS"
    location="jdbc/if/CoreDS"
    xa-location="jdbc/if/xa/XADS"
    ejb-location="jdbc/if/DS"
    connection-driver="informix.some.packaged.JDBCDriver"
    username="scott"
    password="tiger"
    url="jdbc:informix:....."
    />
    ** the connection-driver and URL attributes will be determined by the specific JDBC driver you are using
    c) Use the datasource like any other data source at this point - you should be able to lookup the datasource using the location entries and get a connection.
    If you are using the Oracle9iAS environment as opposed to the standalone environment, then the same set of tasks should be applied using the facilities provided (ie the EM console) by that distribution.
    -steve-

  • Character encoding and ByteOutputStream

    Hi!
    I'm currently working on a web application that needs to print non-english characters (e g swedish � � �). Currently this doesn't work, although i have set the character encoding for the HttpServletResponse.
    I figure that it is this code that doesn't manage the non-english characters (it's not my own code but i need to fix it and, sorry to say, I'm not that experienced with streams):
    ByteArrayOutputStream baos = new ByteArrayOutputStream(16384);
    baos.write("���".getBytes());
    resp.setDateHeader("Expires", 0);
    resp.setContentLength(baos.size());
    ServletOutputStream out = resp.getOutputStream();
    out.write(baos.toByteArray());
    out.flush();
    out.close();Any hints on what to do or where to look? Should i wrap the ServletOutputSream in a Writer?
    Cheers,
    David

    But there's no character encoding set for this operation:baos.write("���".getBytes());

  • Character Encoding and File Encoding issue

    Hi,
    I have a file which has a data encoded using default locale.
    I start jvm in same default locale and try to red the file.
    I took 2 approaches :
    1. Read the file using InputStreamReader() without specifying the encoding, so that default one based on locale will be picked up.
    -- This apprach worked fine.
    -- I also printed system property "file.encoding" which matched with current locales encoding (on unix cooand to get this is "locale charmap").
    2. In this approach, I read the file using InputStream as an array of raw bytes, and passed it to String contructor to convert bytes to String.
    -- The String contained garbled data, meaning encoding failed.
    I tried printing encoding used by JVM using internal class, and "file.encoding" property as well.
    These 2 values do not match, there is weird difference.
    For e.g. for locale ja_JP.eucjp on linux box :
    byte-character uses EUC_JP_LINUX encoding
    file.encoding system property is EUC-JP-LINUX
    To get byte to character encoding, I used following methods (sun.io.*):
    ByteToCharConverter btc = ByteToCharConverter.getDefault();
    System.out.println("BTC uses " + btc.getCharacterEncoding());
    Do you have any idea why is it failing ?
    My understanding was, file encoding and character encoding should always be same by default.
    But, because of this behaviour, I am little perplexed.

    But there's no character encoding set for this operation:baos.write("���".getBytes());

Maybe you are looking for

  • After update to IOS 7x some apps are crashing a lot & system Reboots!

    After installing IOS 7.1.1 on 1 x iPhone 4 16GB, 3x iPhone 4s 64GB and 1 iPad mini 64GB, Apps started crashing which worked well on IOS 5.5 & IOS 6. After Updating to IOS 7, the problems started. Some of my favourite games like "Call Of Duty: Black O

  • How can i set the size of the task windows and text to something more suitable?

    When i bought my HP Touchsmart 600 pc the text size and window size on the desktop were tiny as Default, i manage to change it where it wasnt to big or small it was just right. but recently i had to restore my whole computer back to factory settings

  • Help for a newbie (sort of)

    I finally purchased an iMAC. Last one I had used an OS created by ClarisWorks. So, this is very new to me. Please be patient. 1. Data Sharing There are 2 machines in my house (Windows 7 and iMac). For a better part of 20 years, I have been accruing d

  • TI XHCI USB 3 problem

    We have encountered a problem using a USB-6251 on USB 3 ports with TI XHCI controllers.  The problem has been reported on three new computers all using the TI controller.  We have tested on another computer with a Renesas XHCI controller with no prob

  • How do I get Mavericks? I can't seem to find it in the app store

    The question says it all. Do I buy a DVD? My computer will take yosemite, but I don't feel like upgrading all my ilife, yet.