Problem with unicode in MIME text/html

Hi;
I have a java program that sends email by sending it to our exchange server using SMTP. The email has both a To and a Bcc in the single email sent.
The bcc addressee receives the email fine.
The to address however has a problem with chars that are > 0x7f in the html. The html uses utf-8. But the displayed characters look as though the utf-8 part was ignored.
Also weird, if I go to view, options in Outlook for the bcc email (which is good) it shows:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_0_32437168.1135634913407"
Return-Path: [email protected]
X-OriginalArrivalTime: 26 Dec 2005 22:08:33.0366 (UTC) FILETIME=[E94D1F60:01C60A68]
------=_Part_0_32437168.1135634913407
Content-Type: text/plain; charset=Cp1252
Content-Transfer-Encoding: quoted-printable
------=_Part_0_32437168.1135634913407
Content-Type: text/html; charset=Cp1252
Content-Transfer-Encoding: quoted-printable
------=_Part_0_32437168.1135634913407--
But for the to email (which has the problem), it only shows:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_0_32437168.1135634913407"
Return-Path: [email protected]
X-OriginalArrivalTime: 26 Dec 2005 22:08:33.0366 (UTC) FILETIME=[E94D1F60:01C60A68]
Does javamail do anything weird when it gets an email with a to and a bcc and split it up wrong? I just download and installed the latest mail.jar and activation.jar.
thanks - dave

OK...this didnt quite cure it for me...but having done this AND then this...
MimeBodyPart htmlText = new MimeBodyPart();
final String htmlStuff = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">"
+ "<head>"
+ "<title>Stuff.</title>"
+ "<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=utf-8\"/>"
+ "</head><body>"
+ "<p>Currency Symbols: \u00A3\u00A2\u20A3\u20AC$<p>"
+ "</body></html>";
DataSource htmlSource = new DataSource()
private String stuff = htmlStuff;
private Charset cset = Charset.forName("utf-8");
public String getContentType() { return "text/html"; };
public java.io.InputStream getInputStream() throws IOException
return new ByteArrayInputStream(cset.encode(stuff).array());
public String getName()
return null;
public OutputStream getOutputStream() throws IOException
throw new IOException();
htmlText.setDataHandler(new DataHandler(htmlSource));
htmlText.addHeader("Content-Transfer-Encoding","base64");
This works for me as shown by the Unicode chars in the html.
If you intend to take this to production create a decent external DataHandler class and avoid the use of the anonymous class - which then avoids the need for the final String and the string can come from anywhere then.
Hope this helps,
Barry

Similar Messages

  • Many problems with the 'Export to Text' (.txt) in CR Xi

    Hi,
    I have listed many problems with the 'Export to Text' (.txt) function of CR Xi.
    These problems are related to this export format only (meaning everything works fine in the Viewer or in the 'Export to PDF')...
    - Multi-columns layout do not export as Multi-column (export only a one column);
    - Numeric values with parenthesis for negative values or with a fix currency sign at the leftmost position are not exported correctly;
    - Fields having a Suppress formula which is "WhilePrintingRecords" do not appears when exported;
    - Fields with 'Suppress double value' checked are not always suppressed when exported to Text.
    - 'Keep Group Together' flag is not working.
    - 'Reset Page Number After' simply does not works when exported to text;
    - 'Keep object together' on TextBox/Section is not working.
    - Whenever a group is ending on the last line of a page, the the following page as the same Group header as the previous group with no records until the page is filled, then the PageBreak and PageHeader is missing but the records of the following group appears.
    I would like to know what is the status of the 'Export to Text' function (is it a deprecated function not supported anymore???).
    If still supported, when will these bugs be fixed???
    Thanks

    Hi Rene
    Export to Text is supported till date. Crystal Reports 2008 also supports this with Keep together working however when I tried with format with multiple columns, it didnot show up in the exported text file.
    Regards
    Sourashree

  • Problems with Unicode webapplication

    Hi,
    I am developping a small webapplication which is supposed to support Unicode (different characters such as �S�\ etc.).
    I have a simple form which calls a JSP page.
    The JSP page prints the recieved parameter and prints it to the WEB browser.
    The JSP page also prints the parameter to a file.
    If I use:
         String textIn= request.getParameter("unicodeText");
         byte d[]=new byte[textIn.length()];
         textIn.getBytes(0, textIn.length(), d, 0);
         String unicodeText = (new String(d,"UTF-8"));Everything works fine but if I use:
         byte[] bytes = request.getParameter("unicodeText").getBytes();
         String unicodeText= new String(bytes, "UTF-8");OR:
         byte[] bytes = request.getParameter("unicodeText").getBytes("UTF-8");
         String unicodeText= new String(bytes, "UTF-8");OR:
         byte[] bytes = request.getParameter("unicodeText").getBytes("UTF-8");
         String unicodeText= new String(bytes);The parameter retrieved by the JSP page contains strange characters (such as a box followed by a questionmark) when I submit for example '�\' and '�S'.
    The problem is that the method:
    getBytes(0, textIn.length(), d, 0);used in the working example is Deprecated. In the API documentation I am told that the getBytes()
    Deprecated. This method does not properly convert characters into bytes. As of JDK 1.1, the preferred way to do this is via the the getBytes() method, which uses the platform's default charset.
    I really do not know why I can not get it to work!
    /Fredrik

    Ha again,
    I installed resin and started it with the default
    configuration and changed my jsp file as follows:
    byte[] bytes =
    request.getParameter("unicodeText").getBytes("UTF-8");
    String unicodeText= new String(bytes, "UTF-8");
    What you are doing is unnecessary (but should still work). Instead, simply write:
    String unicodeText = request.getParameter("unicodeText");as the unicode string has already been decoded by the jsp container.
    and this gives the wanted result (i.e. it works).
    I have tried around 20 chineese characters and �
    � and �.
    There is only one small thing... all combinations of
    � � and � works except
    ��� in this order.Really? I have tried the same character sequence (with your above code, and with my simplified version) and both work. Here is my test page:
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ page session="false" %>
    <html>
    <head>
      <title>Test encodings</title>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </head>
    <br />
    <br />
    Request parameters:<br />
    <%
       java.util.Map params = request.getParameterMap();
       for (java.util.Iterator i = params.keySet().iterator(); i.hasNext(); ) {
         String param = (String) i.next();
         String[] values = request.getParameterValues(param);
         out.write("<b>" + param + "=[</b>");
         for (int j = 0; j < values.length; j++) {
           if (j > 0) {
             out.write("<b>,</b>");
           out.write(values[j]);
         out.write("<b>]</b> ");
    %>
    <body bgcolor="#ffffff" text="#000000"
      link="#006699" vlink="#006699" alink="#006699" leftmargin="0" topmargin="0"
      marginheight="0" marginwidth="0">
      <table border="0" align="left">
       <tr><th colspan="2">Enter some values</th></tr>
       <form method="post"
        action="testenc2.jsp"
        <%-- enctype="multipart/form-data" --%>
        >
        <input type="hidden" name="hidden" value="hidden_val" />
        <tr>
         <td>name</td>
         <td>
          <input type="text" name="name" size="50" maxlength="100"/></td>
        </tr>
        <tr>
         <td>address</td>
         <td>
          <input type="text" name="address" size="15" maxlength="20"/>
         </td>
        </tr>
        <tr>
         <td colspan="2">
         <input type="submit" name="cmd" value="send" />
         <input type="submit" name="cmd" value="cancel" />
         </td>
        </tr>
       </form>
      </table>
    </body>
    </html>>
    Anyway, this is a minor problem.
    Now I have to figure out why it works with resin but
    nor with jakarta.tomcat....Doesn't tomcat have a mailing list? That's probably a good place to ask or search.

  • Problem with focus and selecting text in jtextfield

    I have problem with jtexfield. I know that solution will be very simple but I can't figure it out.
    This is simplified version of situation:
    I have a jframe, jtextfield and jbutton. User can put numbers (0-10000) separated with commas to textfield and save those numbers by pressing jbutton.
    When jbutton is pressed I have a validator which checks that jtextfield contains only numbers and commas. If validator sees that there are invalid characters, a messagebox is launched which tells to user whats wrong.
    Now comes the tricky part.
    When user presses ok from messagebox, jtextfield should select the character which validator said was invalid so that user can replace it by pressing a number or comma.
    I have the invalid character, but how can you get the focus to jtextfield and select only the character which was invalid?
    I tried requestFocus(), but it selected whole text in jtextfield and after that command I couldn't set selected text. I tried with commands setSelectionStart(int), setSelectionEnd(int) and select(int,int).
    Then I tried to use Caret and select text with that. It selected the character I wanted, but the focus wasn't really there because it didn't have keyFocus (or something like that).
    Is there a simple way of doing this?

    textField.requestFocusInWindow();
    textField.select(...);The above should work, although read the API on the select(...) method for the newer recommended approach on how to do selection.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.

  • Problem with tabs in xml text

    I have a problem with my XML setup here
    i use Tab key to aligh up info in the xml text for aligned
    display in the program
    hoever i tested on several computers and get different
    resolts.
    how can i fix this.
    Please view the linked Image
    http://img129.imageshack.us/img129/8394/flashtextproblemti4.jpg
    this is what happenes even thow all run xp and all run same
    latest flash version.
    Anyone got an ideer how i can solve this.
    BTW the font is verdana.
    This is my actionscript ....
    // Function to parse an address
    f_parseAddress = function () {
    // Set the text
    _root.stageholder.textfield.htmlText =
    this.firstChild.firstChild.firstChild.nodeValue;
    // Create the XML object
    XML_address = new XML();
    // Set up the XML object
    XML_address.ignoreWhite = true;
    // Add the handlers
    XML_address.onLoad = f_parseAddress;
    // Load the XML file
    XML_address.load("./Data/xml/kontakt.xml");
    This is my XML file
    <?xml version="1.0" encoding="iso-8859-1"?>
    <text>
    <address>
    <![CDATA[
    <font size="20">Company name</font>
    Company name
    address
    address
    Dir. tlf. + xx xx xx xx xx
    + xx xx xx xx xx
    Mobil + xx xx xx xx xx
    + xx xx xx xx xx
    web: <a href="
    http://www.xxxxxxxxxxxxx.xx"><b>www.xxxxxxxxxxxxx.xx</b></a>
    E-mail: <a
    href="mailto:[email protected]"><b>[email protected]</b></a>
    ]]>
    </address>
    </text>
    If anyone got a solution on how i can get my text to allign
    corect
    i would like to hear about it
    Best reguards
    Mis

    alrighty then try this xml structure.
    Note: formatting information like b, or linkage tags should
    not be part of the xml.
    The XML format is a universal format for data, if you fill it
    with style information this is not good practive (in general, there
    are of course scenarios where it makes sense, also since (x)html IS
    also XML).
    In your case you want to put the information about multiple
    companies in a xml file, but you let the flash decide how to
    display format this information.
    so if you use the sugested XMl structure you will have full
    control of the layout within flash, because you can grab every
    piece of information from the xml and place it jsut where you want
    in flash and format it within flash.
    Of course this process is more coding work than your previous
    attempt, but it pays of when you have a lot of data to process and
    when you want to have full control of the final layout.
    But maybe its overkill for your application (I don't know how
    many companies will be stored in your xml and how complex the rest
    of the app is).

  • HT4623 is anyone else having problems with receiving and sending text messages. most people in my contacts are not getting messages that i send to them.

    is anyone else experiencing problems with (SMS) text messaging. Most all of my daily contacts dont receive my messages.

    Make sure you have checked off iCloud contacts in your Contacts app under Groups in upper left corner.

  • Caching problem with iFS web server / index.html

    There seems to be a problem with the iFS Java web server serving cached index.html documents after they have been modified.
    This only happens when the document is referenced by the folder name (e.g. /home/kennu/). If you reference it by the full name (/home/kennu/index.html), the new modified version comes up alright.
    I wonder if this is a bug or some kind of a feature? Is there an quick and easy workaround?
    Byt the way, is this the correct place to post bug reports? I didn't see iFS mentioned in the OTN Bug Database.
    null

    well, this is certainly not an intended effect. i'll look into it. in the meantime, the workaround already posted should pull you through.
    sorry about the inconvenience.
    -ilya
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Kenneth Falck ([email protected]):
    There seems to be a problem with the iFS Java web server serving cached index.html documents after they have been modified.
    This only happens when the document is referenced by the folder name (e.g. /home/kennu/). If you reference it by the full name (/home/kennu/index.html), the new modified version comes up alright.
    I wonder if this is a bug or some kind of a feature? Is there an quick and easy workaround?
    Byt the way, is this the correct place to post bug reports? I didn't see iFS mentioned in the OTN Bug Database.<HR></BLOCKQUOTE>
    null

  • Problem with italicizing/underlining/bolding text

    When I'm typing notes, press enter and attempt to start a new line with italicized/underlined/bolded text, it's very unreliable.  Sometimes it works, most times it does not.  The format tab in the bar at the top will briefly flash blue, but nothing happens.  I've dealt with the same problem in Pages, and in both iWork '09 and the latest version.  I always wind up having to type some text first, then go back and do whatever I want with the formatting, which is a significant waste of time and a major annoyance.  Am I doing something wrong or is this just a case of terrible software design on Apple's part?

    MX6.0 or 6.1?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "anglefish" <[email protected]> wrote in
    message
    news:gqjj44$l98$[email protected]..
    > Pulling my hair out stage - I have installed Dreamweaver
    Mx on my vista
    > laptop
    > and created a website but all the text has an underline
    which I am unable
    > to
    > get rid of. The underline option is not selected it just
    appears. Is this
    > a
    > compatibility problem. Any help would be much
    appreciated.
    >

  • Problem with inverted commas in texts in WAD

    Hi all,
    I've a problem with description texts in WAD. In a graph where one of the columns have the description, let's say something like ' bla"bla ' (in Hebrew we've texts with inverted commas in the middle of the word) and when I point with my mouse on the point to see the value in numbers the text is cut. let's say 'bla"bla' had 15 value it wouldn't show it, but it would show 'bla'. if the text is ' bla ' with value 18, it shows ' bla 18' .
    How can i solve it?
    thank you,
    Yoav.

    Hi Abraham,
    thsi could be a problem from the specisic setting of the infocube. Please check the BEx Settings from the infocube. You can find them by the following steps:
    - search for the infocube
    - doubleclick on the infocube
    - choose an specific infoobjekt
    - right mousebutton and click "specific dataprovider settings"
    - check if the right entries are set
    Hope this will help.
    André

  • Problems with displaying dynamic Arabic text

    We have a problem with a navigation system we are building
    which has to be able to display dynamic Arabic text. We are pulling
    in the Arabic text using XML. The problem we are having is that the
    character are not displaying joined up where they should be (for
    instance in the middle of words). Arabic characters have different
    shaping according to the position they take up within a word. What
    we are producing is apparently unreadable. Has anyone come accross
    this problem before? Is it solveable?

    Hi:
    Is there any possible chance that Adobe would do something to asist us Fl8 users with international character support.
    Everyone has some work-around, except Abode, and they are all usually related to XML.
    My setup is PHP (CMS supporting many languages) -> MySQL -> PHP -> Flash8 (Dynamic Text Fields) and the olpart that does not work is when I inject an extended character into the string - Flash stops displaying anything from that character on.
    If Adobe has or did have some component / solution or anything other than the usual System.useCodePage = true (which never seems to actually work), please let me know.
    Best Regards,

  • Problem with After effects present text animations

    When I want to use the text animation presets I get an error message, an example is when I want to use a text "animate in" preset and got the following error message:  After Effects error:  Can't import file "Fly In From Bottom.ffx": unsupported filetype or extension. ( 0 :: 1 ). I have check my bridge script settings and they are activated for After effects.

    Sounds like you are trying to import a FFX file instead of applying an animation preset. Some users are reporting problems with Bridge. Just type the name of the animation preset into the Effects and Presets panel and apply it from inside AE.

  • Problems with downloading pics from text?

    Hi  - is anyone else having problems downloading pics attached to text after running the 4.1.2 upgrade?
    I've tried powering on and off - turning off wi-fi and just having data...(and vice versa)...to no avail.   the text and pictures are coming from another verizon user....they have a "non-smart" phone.

    Have you performed a System Cache wipe since the JB update? I would try it, it will not wipe your phone, you will not lose anything. If you are going to do this, make sure you follow the instructions exactly, as failure to do that could wipe the phone by accident.
    Turn the phone off and perform Clear Partition. Clearing the partition will remove any temporary files that may be causing the problem, but will not delete your files or settings.
    - Power the phone down.
    - Hold the volume up and down and power key down all at the same time until you see the Boot Mode Selection Menu. This should happen within a couple of seconds.
    - Press the volume down key until "Recovery" is highlighted. Press the volume up key to select.
    - Wait until you see a triangle with an exclamation point in it.
    - Press and hold the volume down key. While doing that, press and hold the volume up key then release them. This should put you into the Android system recovery.
    - Press the volume down key until wipe cache partition is highlighted.
    - Press the power button to select. You will be brought back to the Android system recovery utility when it is complete.
    - Press the power button to select "reboot system now". Wait for the phone to boot.
    Check to see if it cleared the problem. This fixed a couple of app issues with my RAZR after the update.

  • Intermittent problem with PC Suite - no text is di...

    I have an intermittent problem with PC Suite - every so often it will stop displaying any text.
    For eaxmple, right-click on the task bar icon gives a list of icons for backup, messages, sync etc., but the text is missing.  Also, the 'tool-tips' in the application itself are empty grey boxes.
    Restarting PC Suite solves the problem for a while, but it always comes back.
    The main problem is that when it gets in this state, incoming call alerts don't show the name/number.
    Has anyone else had this and managed to sort it.
    I'm running PC Suite 7.1.40.6 on a Lenovo ThinkPad T61p running Windows XP SP3.  The phone is a 6230i connected via Bluetooth.
    Thanks.
    Alan.

    Yes the Support line directed me to try a different USB port, with no luck.
    Also looked for the connection in windows device manager>>nothing appeared except the computers ports...
    [quote]Hi, Here is something what you could try to do: 1. Uinstall Nokia PC Suite 6.82.22 (or 6.7 or 6.8x) and restart PC. 2. Go to Windows' Control Panel and open "Add or Remove Programs" application. 3. If there are "PC Connectivity Solution" (or "Nokia PC Connectivity Solution" and/or "Nokia Connectivity Cable driver", uninstall those and restart PC. 4. Install PC Suite 6.82.22 and restart PC. If problem happen again: 1. Go to Windows' Control Panel and open "Add or Remove Programs" application. 3. Select "PC Connectivity Solution", click "Change" and then "Repair". 4. After Repair, restart PC. And if no help again: Save RegPCSuiteComponents.bat file to C:\Program Files\PC Connectivity Solution\ folder. Then go that folder and run it (double-click that file). After that restart PC. Does any of those help you?? [/quote]
    I've tried your 1st & 2nd suggestions....but I can't find the "connectivity solution" folder you mention (and being a complete noob (!) I don't know what a .bat file is (nor how to use it lol)
    In fact I can't find PC Suite anywhere in the program files. I REALLY think that it wasn't installed OK....it should not have taken less than one second to download if it took 1 3/4 hrs initially

  • Does anyone have problems with some websites where text is overwritten and it is impossible to navigate the site as the buttons to for example confirm purchases do not work?

    I am having problems with some websites - e.g. Easyjet and more recently the Sport Relief website, where the text overwrites other text and images and it means it is impossible click to accept, confirm or find further information?

    lindsayfromstow on the wold wrote:
    I am having problems with some websites - e.g. Easyjet and more recently the Sport Relief website, where the text overwrites other text
    Post a screen shot.
    What browser and what version are you using?
    Have you tried a different browser?

  • Problems with the selection of text or objects

    dear fireworks community!
    unfortunately i have problems with my running version fireworks (CS6) and i can't find any solution or even get help via the customer support.
    i can't switch between objects with a click, when i've choosen one already. i also can't cancel the entire selection. the only way (to select a new item) is to click on an empty space, hold it and pull the selection over a new item.
    another thing is that i cant select a textfield with a doubleclick or switch beteween choosen tools within the usage of a shortcut …
    what i already tried:
    updating, deinstalling, re-storing preferences, "cleaning" the libraries, installing (this entire scenario for at least three times)
    i hope someone of you can help me!
    thanks in advance!

    incredible!
    thank you so much!

Maybe you are looking for