Weblogic 12c Servlet Response - Special characters show up as question mark

My web app is running on Weblogic 12c (12.1.1) using WebWork + Hibernate. The program streams data (bytes making up a pdf) from a CLOB in an Oracle Database to the AsciiStream of the servlet output response. No exceptions are thrown, but the generated pdf contains blank pages. Comparing the bytes of the generated pdf, special characters are showing up as question marks.
Some of the bytes read in from the database contain 8 bits (correct data), but the bytes that the servlet return contain only 7 (all bytes with 8 bits become "1111111"). The number of bytes returned from the servlet is correct.
Code:
//Response is HttpServletResponse
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=\"test.pdf\"");
out = response.getOutputStream();
byte[] buf = new byte[16 * 1024];
InputStream in = clob.getAsciiStream();
int size = -1;
while ((size = in.read(buf)) != -1){
// buf contains the correct data
out.write(buf, 0, size);
// other exception handling code, etc
out.flush();
out.close();
"Correct" pdf byte example:
10011100
10011101
1010111
1001011
1101111
11011011
Incorrect pdf byte example:
111111
111111
1010111
1001011
1101111
111111
I have verified that the data read from the CLOB in the database IS correct. My guess is that the Weblogic server has some strange servlet settings that causes the bytes to be written to the servlet output stream incorrectly, or a character encoding issue. Any ideas?
Edited by: 944705 on Jul 26, 2012 10:17 AM

Solution found, I'll post the work around to those who might encounter the same problem.
Somewhere in the layers of technology (webwork or weblogic I'd guess), the servlet response is encoded into UTF-8 regardless. The encoding in the database was ISO-8859-1. Sending ISO encoded bytes by UTF-8 caused the conflicting character codes (anything above 127) to show up as undefined.
The fix is to decode the input byte array into ISO-8859 string, then encode that string into UTF-8, which can be send by Weblogic.
isoConvert = new String(buf, "ISO-8859-1");
out.write(isoConvert.getBytes("UTF-8"), 0, isoConvert.getBytes("UTF-8").length);

Similar Messages

  • Special characters are changed to question marks

    I'm using SQL developer 3.107 for unit testing.
    In a particular unit test, the expected result is a sentence (varchar2) with a special character (ë).
    But when I save the result, SQL developer changes the character to 2 question marks.
    And as a result, the unit test fails because the expected result differs from the received result (where the 'ë' remains unchanged).
    I already tried changing the encoding in the SQL Developer preferences from cp1252 to UNICODE and UTF8 but that didn't help.
    Any suggestions?
    Thanks in advance

    Hello:
    I guess that what you observe could be an interaction between the server characterset and the client characterset.
    These are the results with different client characterset settings:
    NLS_LANG=american_america.WE8ISO8859P1
    select 'ë' c, dump('ë') dumped from dual;
    C DUMPED
    ë Typ=96 Len=1: 137
    NLS_LANG=american_america.WE8MSWIN1252
    select 'ë' c, dump('ë') dumped from dual;
    C DUMPED
    + Typ=96 Len=1: 191
    set NLS_LANG=american_america.WE8PC850
    select 'ë' c, dump('ë') dumped from dual;
    C DUMPED
    ë Typ=96 Len=1: 235
    According to the ISO 8859-1, 8-bit single-byte coded graphic character sets document [http://www.open-std.org/JTC1/SC2/WG3/docs/n411.pdf] the encoding of the latin small letter e with diaeresis is 0xEB -> (decimal 235).
    If you set the client to WE8PC850 do you see a correct behaviour?

  • N8- Arabic characters show up as question marks in...

    Hi ..
    I noticed that the subject of the email is shown in the right way ( correct form of arabic characters)..
    but the body of the email which is formatted in some font and color show up as ???????????
    that replaces the arabic characters !!!
    while the exact same email show up correctly in the browser ,, but not the email ..
    ps: my phone is N8 ..
    thanks in advance..

    Dear petrib, what you are saying is 100% right, but its also Nokia issue to fix the problem with Microsoft for their customers to be satisfied... the problem is not when using Windows Live through PCs, I have the problem in my Nokia device and i am trying to contact Nokia to solve it with Microsoft... Am I right ??

  • Language:  Filename with characters for arabic turns question mark

    Language: Filename with characters for arabic turns question mark
    OS: Solaris 9
    Machine: Sun-Fire 25K
    There is an adobe distiller software that is configured and a java apps. There are postscript files that are being converted to .pdf format using the adobe distiller. Using the GUI (using the Exceed; for remote access), when they use GUI to convert the postscripts to pdf files, the long filenames have the corresponding characters for arabic reading purpose. This is OK.
    When we use the windows RUN to telnet the server and convert the postscripts to pdf, it gives a question marks characters in the filenames ( this; is a sample; filename; ?? ??? ??; right.pdf )
    We are not sure now if we have to add a package of arabic or a patch to resolve this problem.
    Message was edited by:
    yurioira32
    Message was edited by:
    yurioira32

    Solution found, I'll post the work around to those who might encounter the same problem.
    Somewhere in the layers of technology (webwork or weblogic I'd guess), the servlet response is encoded into UTF-8 regardless. The encoding in the database was ISO-8859-1. Sending ISO encoded bytes by UTF-8 caused the conflicting character codes (anything above 127) to show up as undefined.
    The fix is to decode the input byte array into ISO-8859 string, then encode that string into UTF-8, which can be send by Weblogic.
    isoConvert = new String(buf, "ISO-8859-1");
    out.write(isoConvert.getBytes("UTF-8"), 0, isoConvert.getBytes("UTF-8").length);

  • Arabic characters are displaying as question marks in forms 10g

    We have migrated our application from forms 6i to forms 10g and now in forms 10g the arabic characters are displaying as question marks while it displays correctly in the old application using forms 6i. I have already set the character set to AR8MSWIN1256 in the registry, but it didn't help. Somebody please help.

    @ Sarah, Al-Salamu Alikum We Rahmatu Allah we Barakatu,
    Sarah Habibty, why new installation ? In order to select a new suitable character set !!!
    Then creating a new instance from the db is a better alternative since it saves time,effort and another back up of his current db is exist safely if needed for any purposes in the future.
    @Amer,honestly speaking...
    Modifing ur NLS_LANG to > AMERICAN_AMERICA.AR8MSWIN1256
    Works for me in both Arabic and English data in 2 applications.This works in my pc.But it didn't works at my boss pc this can happened don't have any reason for that.!!!!
    i spent lot's of time trying to search but what i had got is that solution i suggested by a friend of mine.
    Now please could you advise me, is it better to create a new instance of database as Amatu Allah has suggested or is it better to change the character set through sql as some others have suggested? Again i suggest to select the short cut way ; to reset the character set through sql after taking a back up from ur data that is currently exist.
    then retest again doing the select and test ur data input and retrieval.
    SQL> select * from v$nls_parameters
    2 where parameter in ('NLS_CHARACTERSET','NLS_LANGUAGE');watching the output if it works that's fine saving ur time & effort .
    if not working with the correct NLS_CHARACTERSET then use my previous solution.
    Hope this helps...
    Regards,
    Amatu Allah

  • HT1752 My MacBook on startup shows file with question mark ,, what now?

    My Mac shows file with question mark, what now.

    Press the power button down to force a emergency use only hardware shutdown.
    Press and hold the Option/alt key on the built in keyboard, boot the machine.
    If MacintoshHD appears, select it and click the arrow, then in System Preferences > Startup Disk reset that. Done.
    Sometimes a NVRAM reset is required then the above done again.
    Folder with question mark issue
    ..Step by Step to fix your Mac
    If MacintoshHD doesn't appear, or if it boots to gray screen or other issues, then it's more complicated of a fix, but once inside OS X then reset the Startup Disk.
    Gray, Blue or White screen at boot, w/spinner/progress bar
    ..Step by Step to fix your Mac
    You might need this if you don't have a recent backup and your problem is software related, Disk Utiltiy can't fix the drive and recommends you backup, erase and install.
    .Create a data recovery/undelete external boot drive
    If Disk Utility + Hardware Test shows no boot drive, then you have a dead drive or cable, or Mac issue.
    My computer is not working, is my personal data lost?

  • Everytime I try to load system preferences drom th icon it shows up a question mark and does not respond

    Everytime I try to load system preferences the icon shows up a question mark and does not respond

    Which icon is behaving that way? The one in the Dock, or the one in the Applications folder?
    Does System Preferences open OK when choosing that item in the Apple menu?

  • I have macbook mid 2009, with os leopard and I updated it till yosemite now while deleting partition I erased the main hitachi drive , now I have no backups and while switching on it shows folder with question mark,inserting the grey dvd it keep spin

    Have macbook mid 2009, with leopard,  updated to yosemite,  while erasing partition erased hd, dot have backups, powerup shows folder with question mark, inserting grey dvd shows apple and spinning wheel, please help

    Clean Install of Snow Leopard
         1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
             with your computer.  Insert the disc into the optical drive and restart the computer.
             After the chime press and hold down the  "C" key.  Release the key when you see
             a small spinning gear appear below the dark gray Apple logo.
         2. After the installer loads select your language and click on the Continue
             button. When the menu bar appears select Disk Utility from the Utilities menu.
             After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
             size.)  Click on the Partition tab in the DU main window.  Set the number of
             partitions to one (1) from the Partitions drop down menu, click on Options button
             and select GUID, click on OK, then set the format type to MacOS Extended
             (Journaled, if supported), then click on the Apply button.
         3. When the formatting has completed quit DU and return to the installer.  Proceed
             with the OS X installation and follow the directions included with the installer.
         4. When the installation has completed your computer will Restart into the Setup
             Assistant. Be sure you configure your initial admin account with the exact same
             username and password that you used on your old drive. After you finish Setup
             Assistant will complete the installation after which you will be running a fresh
             install of OS X.  You can now begin the update process by opening Software
             Update and installing all recommended updates to bring your installation current.
    Download and install Mac OS X 10.6.8 Update Combo v1.1. From here you can upgrade to Yosemite by re-downloading it from the Purchases page in the App Store.

  • SSID with special characters showing up in place of the letters

    On a Win 7 machine the SSID list of available wireless networks is showing up with special characters in place of the normal letters in the name of the SSID... It has nothing to do with the Linksys Router, it is a problem on this computer. It makes it impossible to connect to a wireless network. I removed the device and reinstalled it hoping that might help. I can't find any viruses, (Known Viruses) Has anyone here seen this before? I am atttaching a photo of this. Any help appreciated.

    marke1102 wrote:
    On a Win 7 machine the SSID list of available wireless networks is showing up with special characters in place of the normal letters in the name of the SSID... It has nothing to do with the Linksys Router, it is a problem on this computer. It makes it impossible to connect to a wireless network. I removed the device and reinstalled it hoping that might help. I can't find any viruses, (Known Viruses) Has anyone here seen this before? I am atttaching a photo of this. Any help appreciated.
    Is this the only computer having a problem? How many wireless devices are connected and working to the router right now?

  • Pages '09 special characters showing up weird

    Hi, I am a new Mac user and i have found that in pages '09 some of the special characters are not displaying correctly, the main problems are with the mathematical x and y symbols, if I copy and paste the strange characters out of pages then they display correctly it is just in pages that I have the problem. come to think of it the error came along when i upgraded to the latest version of Mountain Lion, could this be a problem?
    This is an example of the characters x and y:

    Never mind, I found it via google.  Unicode 1D465 for the X. 
    This is because the font in your document does not have that character or uses it for a differnt symbol. When you drag the symbol from the center pane of the character viewer, it pastes it in using whatever font you are using. If you look at the character viewer and look at the font variations, you will see Cambria Math as one of the variations. Drag the symbol from there and it will display correctly (because it will be pasted in as Cambria Math). Or you can use the Cambria font in your document and drag the X from the center pane.

  • Some characters are replaced by question marks!

    All of a sudden my iMac (OS X 10.5.1 Leopard) is displaying question marks for some special characters.
    For example, on internet, look up a word "pediment" in Yahoo! Dictionary ( http://education.yahoo.com/reference/dictionary/entry/pediment)... Instead of showing the "dot" symbol to identify a syllabus break, it shows question marks as ped?i?ment, and instead of showing c with a little squiggle underneath for a word facade (within the definition of pediment), it shows fa?ade.
    I did not have this problem on my iMac on Tuesday (01/29/08) morning and I have not installed anything other than the Apple updates.
    I tried with FireFox and Safari, and both show the same thing. Then I went and checked my husband's iMac (OS X 10.5.1 Leopard) and it has a same problem, so I know it is not just my iMac.
    Then (yes, there is more...) I started to work on my Word document and tried to insert "symbol" from insert on the Toolbar... many of my symbol fonts (Symbol, Osaka, etc) has question marks replacing special characters.
    Please help! I am unable to complete my work without these special characters!!

    Well, I went to the Yahoo! Dictionary "Pediment" and it said it was set to Default which is set to Western (ISO Latin 1), so I assumed it was Western (ISO Latin 1). But when I click on Western (ISO Latin 1), the pages appear what it's supposed to look like with special characters... What does this mean?
    I reset all the settings; I chose something else as default, quit Safari, opened it and chose Western (ISO Latin 1) as a default to see if it changes anything... No change. It says my default is Western (ISO Latin 1), but it seems not.
    I am officially confused and have no clue what to do...??????!!!!!
    On the bright side, at least I can get my work done, even if I have to change the encoding one page at a time... Thanks.

  • Special Character being replaced by Question Marks in Java Mapping

    Hi All,
    I need some help on Java Mapping related to special characters.
    The problem is that i'm using a Java Mapping to add some information to the XML inside the Interface Mapping. This works fine on our development environment but, in our production environment, it replaces the special character with question marks (eg.: á --> ??).
    I'm suspecting of some configuration on the Java Virtual Machine that sets the encoding, but i don't have access to it. Does anyone have any clues about this problem?
    Thanks a lot,
    Leonardo

    Hi Leonardo
    Have a look at this forum thread, this might help you to solve your problem.
    Java Map Causing error because of ampersand &

  • A music file on my iWeb website shows as a question mark and won't play.  Anyone know how I can fix this?

    When I view the website using Firefox, it shows and plays beautifully.  But, when I view it on Safari, there is a tiny question mark where the audio control should be, and no music plays.  I'd really appreciate some help with this one.
    Many thanks,
    Joe Perrone Jr.
    Author
    www.joeperronejr.com (in case you want to see the site)  It's the Home Page

    I just opened your site with Safari and on the Home page the music play straight away and then there is the player at the bottom right of the page which I can see with no problem at all.
    Perhpas you need to empty your brower cache for it to display correctly - it seems to be working correctly for others here who have viewed it in Safari.
    Check your preferences and perhaps clear your cookies and then empty your browser cache.

  • My iMac has a blank screen with an icon showing a flashing question mark.  I have rebooted and still nothing but that on the screen.

    My iMac has a blank screen showing an icon with a blinking question mark.  I have rebooted and still the same.  Any ideas?

    Mac OS X: Gray screen appears during startup  BTW, iOS info is useless, post machine and OS version specifics.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • Safari not showing images as Question Marks

    Hello Forum,
    we have a strange behaviour from a shop website in Safari for Mac and Windows Platform.
    It is a site with frames. When i click on the Categorie Nagivation it comes to situations when one of the frames reloads.
    After this frame reload the pictures only show as question marks. When i click one of the images it will reload the pressed picture and shows it. The other ones remain as question marks.
    The System Layout goes like this: Apache Server takes requests and redirects it to an application shop Server.
    Most of the Images are on Apache, the top navigation with the problem comes from the application server.
    Does anyone has a clue where to search for this problem?
    Firefoy and IE don't have this problem.
    Regards
    Jannis
    P.S. its the newest Version of Safari installed on Mac or on Windows.

    Hi Carolyn,
    thanks for your answer.
    The setting is still checked in Apperances.
    I tried to unckeck and check it again, but it woh't solve the problem.
    What i think is, that Safari has a problem with our system design or with http headers he interprets in another way than other browsers.
    What i found out too is, that there is Java Script. Are there differents how Safari interprets them?
    Regards
    Jannis

Maybe you are looking for

  • Free goods by a program

    How to create a sales order with free goods with an abap function? Now, I'm creating a sales order with  function 'SD_SALESDOCUMENT_CREATE' but don't know how to include free goods. I would like to use a manual condition type to introduce free goods

  • Chinese characters missing in PDFs (Preview)

    Hi there! In many of the Chinese language PDFs from journal articles, bits are missing: rare characters, western letters and numbers. The PDFs display fine in Adobe Reader, but not in Preview, Devonthink, and on the iPad in PDF expert. Any suggestion

  • Problem in creating include program for customer exit for BC425_01

    Hi,      I want to write a customer exit for transaction BC425_01. For identifying the include program for exit , i go to System->Status.There I double click on the program name(GUI).Then I perform a 'FIND' in main program for 'customer-function' key

  • Concatenate multiple pdf files into one single postscript file

    Hi, Could anyone help me with a code to "Concatenate Multiple pdf files into one single postscript file" ? Thanks for the help

  • Download Itunes 7, but no install, why?

    I went to the Apple website to download the lastest version (it said thanks for download), but no install happened, why not? Wasn't this suppose to install automatically? I wouldn't think I'd have to install manually. I'm wondering where the software