I18n: having problems when sending accents through sockets

Hi, I need help. I have to send a file, plain text whith accents. Say I have the following sentence in Spanish, "hace fr�o" (it's cold); when the server gets the file, what I get is: "hace fr?o".
I'm using the following on the client side:
PrintWriter os = new PrintWriter(new BufferedWriter(new OutputStreamWriter(client.getOutputStream(),
"ISO-8859-1")),true);
and the next one on the server side:
is = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO-8859-1"));
what am I doing wrong? I don't know whatelse I could try. I'm starting to think maybe it has to do with some configuration file in my machine (LINUX). Any idea?
Thanks a lot!

First of all, thanks a lot!
It does work exporting LANG; however, it doesn't work using InputStreamReader and the charset.
  Reader fichProcesar = new InputStreamReader(new FileInputStream(args[0]), "ISO-8859-1");
  infich = new BufferedReader(fichProcesar);
   //env?o del fichero l?nea a l?nea hasta la l?nea FIN
   while (true) {
          String lineaProcesar = infich.readLine();
          System.out.println("Linea a enviar "+ lineaProcesar);
          os.println(lineaProcesar);
          if (lineaProcesar == null) break;
    }I don't want to bother you, but I prefer the option of using fixed encoding. It's
"more portable".
Could you tell me if I did something wrong, again, this time?
Thanks a lot for your time.
FileReader uses the platform's default encoding for
reading the file. On a *nix system (like Linux) the
default encoding depends on the locale settings; if
you have not set the locale the default encoding is
US-ASCII that doesn't support accented characters.
You can either set up a locale that supports accented
characters or use a fixed encoding for reading the
file.
A locale is simply set up by setting the environment
variable LANG to some value, like "es_ES" for Spanish
in Spain. If you use the bash shell the command you
need is "export LANG=es_ES"
To use a fixed encoding use FileInputStream with an
InputStreamReader. For instance if the file is
ISO-8859-1-encoded you'd use code like
this:Reader fichProcesar = new
InputStreamReader(new FileInputStream(args[0]),
"ISO-8859-1");

Similar Messages

  • I18n: having problems when sending accents throw sockets

    Hi, I need help. I have to send a file, plain text whith accents. Say I have the following sentence in Spanish, "hace fr�o" (it's cold); when the server gets the file, what I get is: "hace fr?o".
    I'm using the following on the client side:
    PrintWriter os = new PrintWriter(new BufferedWriter(new OutputStreamWriter(client.getOutputStream(),
    "ISO-8859-1")),true);
    and the next one on the server side:
    is = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO-8859-1"));
    what am I doing wrong? I don't know whatelse I could try. I'm starting to think maybe it has to do with some configuration file in my machine (LINUX). Any idea?
    Thanks a lot!

    double post: http://forum.java.sun.com/thread.jsp?forum=11&thread=556005

  • HTML Tag problem when sending mails through APEX

    Hi,
    My code for sending mail is below:
    DECLARE
    l_body CLOB;
    l_body_html CLOB;
    cursor c2 is
    SELECT pn,pdt_name FROM lib_details WHERE a_date BETWEEN to_date(:P13_SDATE,'DD-MON_YYYY') AND to_date(:P13_EDATE,'DD-MON-YYYY');
    BEGIN
    for c_lib in c2
    loop
    l_body_html:=l_body_html ||
    '<html><body>
    ul>
    li>'||c_lib.pn||' , '||c_lib.pdt_name||' /li>
    /ul>'; p;
    l_body_html:=l_body_html ||'</body></html>';
    apex_mail.send(
    p_to => 'xxxx',
    p_from => 'xxxx',
    p_body => l_body_html,
    p_subj => 'Test Mail');
    END;
    Gives me the output in the format below:
    all the <html><body> tags also comes along with the email, though I get the correct output, what is the problem here?
    I am not able to figure this out. Can someone help?
    OUTPUT
    <html><body>
    ul> li>a,b
    /ul><html><body>
    ul> li>c,d
    /ul><html><body>
    PLEASE NOTE: I have intentionally removed the starting tags (<) of ul and li so that the post will not be formatted.
    Edited by: Suzi on Feb 9, 2012 1:18 PM

    >
    Gives me the output in the format below:
    all the <html><body> tags also comes along with the email, though I get the correct output, what is the problem here?
    I am not able to figure this out. Can someone help?For HTML output you need to send it using the <tt>p_body_html</tt> parameter, not <tt>p_body</tt>.
    PLEASE NOTE: I have intentionally removed the starting tags (&lt;) of ul and li so that the post will not be formatted.Posting code wrapped in <tt>\...\</tt> tags eliminates the need to resort to these bizarre circumlocutions.

  • HT1414 I am going through the process of unlocking my iphone 4 and have had all the go aheads from my service provider but i am still having problems when i plug the phone into itunes. Has anyone else had this program

    I am going through the process of unlocking my iphone 4 and have had all the go aheads from my service provider but i am still having problems when i plug the phone into itunes. Has anyone else had this problem??

    Umm, what problem?  What actually happens when you try to restore it in iTunes?

  • Problem in sending mail through dynamics actions

    Hi Friends,
    I have a problem in sending mail through dynamics actions . In this  we pass a subroutine in dynamics actions which send an mail when promotion action occured.
    Problem is that sometimes it will  send an mail or sometimes not. I have no idea to solve this problem.
    Can anyone suggest me .
    Thanks ,
    Anish
    Moderator message : Duplicate post locked.
    Edited by: Vinod Kumar on Sep 5, 2011 9:45 AM

    Hi,
    Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
    thank You

  • Having problems in sending email..always saved in outbox and cannot send mail bcoz of the server failed

    Having problems in sending email..always saved in outbox and cannot send bcoz of server failed

    The email server you are using to send mail through requires the password, if any is required it needs to be set in the location that I pointed out in the earlier post.
    It is usually the same password you use for receiving emails.
    I don't use either Facebook or Twitter so I am not sure how to help with those.

  • I'm having problems receiving/sending emails thru Outlook.

    I switched internet connection from AT&T to Comcast and I'm still utilized several AT&T email address's for free. I'm having problems receiving/sending emails thru Outlook.  Could the problem be due to using their free emails with no support.
    Do I have to go thru yahoo to read/send emails?

    Change the ISP would not effect the email connection generally. (Only when ISP disable your mailbox which they could control directly.)
    I suppose that your Outlook still store/cache the AT&T messages, try to export them as PST data file for backup.
    Setup the new Yahoo in your current Outlook first and then import that backup.pst to continue to use.
    http://support.microsoft.com/kb/287070/en-us
    Thanks
    Tony Chen
    TechNet Community Support

  • HAVE A PROBLEM WHEN SENDING AN EMAIL IT STATES IT DOES NOT ALLOW RELAYING

    HAVE A PROBLEM WHEN SENDING AN EMAIL IT STATES IT DOES NOT ALLOW RELAYING

    You have either entered the wrong SMTP server info or they have blocked the sending of e-mails from outside their network. That message indicates that you are not permitted to send through that server from the network you are using to connect.
    Contact them again. There is no magic that will allow you to bypass this.

  • Problem when send an email with mail client!

    Hi!
    My mail server have MTA front end and Message Store back end with version:
    ./imsimta version
    Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)
    libimta.so 7u2-7.02 64bit (built 02:28:03, Apr 16 2009)
    Using /opt/sun/comms/messaging64/config/imta.cnf (compiled)
    SunOS SMSG 5.10 Generic_139556-08 i86pc i386 i86pcMy users and I are having problem following: Send an email very slow, mail client is connected to front end but mail is not delivered, after that, I stop and resend this email several times then it is can delivered. While the mail was not send, i can telnet to front end with port 25. My users and I are using Thunderbird and Microsoft Outlook. What is problem on my mail server ?
    I see time on MTA front end and Message Store are not synchronized, maybe this could be the problem?
    Thanks!

    NguyenPhuc wrote:
    Are you using any kind of MTA spam filter plugin?I removed plugin spam filter, now on MTA server don't have plugin spam or virus !Are you saying you did have a spam filter plugin enabled (if so which one(s)) and you have just disabled it?
    Are you receiving an excessive number of emails?No, total of number messages in my mailbox is about 1000 emails.I meant is the MTA receiving a large number of emails -- i.e. do you see a lot of emails coming in (mail.log_current)?
    Also try the following and see where the delay in accepting emails occurs:
    telnet <mta> 25
    mail from: [email protected]
    rcpt to: [email protected]
    data
    Subject: test email
    To: [email protected]
    From: [email protected]
    body
    .e.g.
    -bash-3.00# telnet server 25
    Trying 10.15.10.33...
    Connected to server.aus.sun.com.
    Escape character is '^]'.
    220 server.aus.sun.com -- Server ESMTP (Sun Java(tm) System Messaging Server 7u3-16.01 64bit (built Apr  6 2010))
    mail from: [email protected]
    250-2.5.0 No HELO/EHLO seen; continuing anyway, [10.15.10.33].
    250 2.5.0 Address Ok.
    rcpt to: [email protected]
    250 2.1.5 [email protected] OK.
    data
    354 Enter mail, end with a single ".".
    To: [email protected]
    From: [email protected]
    body
    250 2.5.0 Ok, envelope id [email protected]
    quit
    221 2.3.0 Bye received. Goodbye.
    Connection to server.aus.sun.com closed by foreign host.Regards,
    Shane.

  • Adobe AIR apk for android having problem when running in tablet

    Already we know AIR having problem when running on some tablet,shows black color for some time after clicking icon and rendering process also very slow mean while game performance is too low and stage frame rate also reduced not 24 fps.
    My case is other than Samsung tablet , Some tablet like asus transformer ...etc  Adobe AIR  works smoothly except in some cases the font changes.it means Arial regular never appears and bold option in htmlText is also not working and sizes also reduced.it shows different not like working in android mobile phones.it is totally changed.but works fine and appears bold in android mobile phones.
    can any one having these kind of problem???
    any one give solution for me???
    or explain why happend like this???

    I don't know how your application is structured, but if you can split sections off into separate SWFs(plain AS3 document) then you could host those section SWFs online and require the user to download them on first run.
    You could use the FileReference object to download the SWFs, save them to the File.applicationStorageDirectory, and then display/load them up with the Loader object when needed from the app storage directory. You would possibly need to check to see if the files are present at every boot of the app though as a user could "Clear Data" or "Clear Cache" of the app in the Settings of their device and one or both of those could/would delete the downloaded files.
    FileReference - Adobe ActionScript® 3 (AS3 ) API Reference

  • I am having problems when i have minimized windows and try to open a new window it will open all minimized windows along with the new window. It just changed when mozzilla updated. It did not do this before the update.

    I am having problems when i have minimized windows and try to open a new window it will open all minimized windows along with the new window. It just changed when mozzilla updated. It did not do this before the update. Before the update if i had minimized windows they would stay minimized when i opened a new window. Please help ,I would guess it is just a setting somewhere but i cannot figure out where the setting is. Thanks jason

    This issue can be caused by the ASK.com Toolbar.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Help me, I am using flash pro cc and air 4.0,i have one problem when publishing apk through air publish settings,choosing the run time option from third party is disabled.can any one help me bcoz i have to publish without air runtime.......

    Help me, I am using flash pro cc and air 4.0,i have one problem when publishing apk through air publish settings,choosing the run time option from third party is disabled.
    can any one help me bcoz i have to publish without air runtime.......

    Hi,
    This option is available when your publish target is set to AIR 3.6.
    You can download the desired AIR SDK version from Archived Adobe AIR SDK versions
    Thanks!
    Mohan

  • I am having problem when i am updating my iphone 4 to ios 5 ..it get update n took 50 minutes then at the end when it was processing file ...suddenly an error comes that an unknown error accurred {9006}..please help me..how will i update my iphone 4

    i am having problem when i am updating my iphone 4 to ios 5 ..it get update n took 50 minutes then at the end when it was processing file ...suddenly an error comes that an unknown error accurred {9006}..please help me..how will i update my iphone 4

    Error 9006: Following Troubleshooting security software frequently resolves this error. There may be third-party software installed that modifies your default packet size in Windows by inserting a TcpWindowSize entry into your Registry. Your default packet size being set incorrectly can cause this error. Contact the manufacturer of the software that installed the packet size modification for assistance.

  • I have a MBP retina and I am having problem when my bluetooth and wifi are both active. My wifi is totally unusable when I am connected to via bluetooth speaker.

    I have a MBP retina and I am having problem when my bluetooth and wifi are both active. My wifi is totally unusable when I am connected to via bluetooth speaker.

    Chances are you mis-typed a character in the Wifi password and the devices saved that information.  Now whenever you try to connect the device refers to the wrong password and the Jetpack does not accept your connection.  Tell your devices to forget the wireless connection and start over.
    Once you enter the proper WiFi credentials the Jetpack will allow you to connect.

  • TS3899 Re Hotmail account. Was having problems receivingand sending  e mails on my ipad. computer ok. deleted account on ipad and reinstated it. inbox ok but other mailboxes on computer i.e Drawings and Private, etc with ifo in are not on ipad. c

    having problems receiving/sending e mails on ipad, deleted hotmail account and reinstated it. inbox now ok but my folders i.e drawing, deleted, sent etc have disappeared.they still show in my hotmail on my computerand iphone, they contain info i need on my ipad.     How do i transfer or obtain these folders on my ipad with the info intact

    when you put your mail back onto your iPad did you use the outlook option in the mail settings?

Maybe you are looking for

  • Weird Behavior in Form

    Hi everybody, I have foud weired behavior in my form. I created master detail relation ship between two tables. I kept Deffered and Automatic query property of realtion to NO. I run the form and i clicked on execute query. it works properly. When fir

  • Menu Bar In Muse CC 2014 vs. Menu Bar in Muse V7.4

    Ok! I admit to old age and failing eye sight but I something I do not understand is why are their two versions of Muse and which one should I be using? Muse 2014 appears to have more features but the menu bar and subsequent drop down menu's are extre

  • Acquiring data from all the analog channels of NI-3202 NODE using a single sensor

    Hi all, I would like to know that can i be able to get the data from all the four analog channels of NI-WSN node 3202(analog input node) connecting only single sensor on the analog input and connecting all the remaining analog inputs using wires and

  • My iphone 3g won't play on tv

    even though I bought the adapter and hdmi.  when I plug in the adapter the phone says "this accessory is unsupported."  anyone seen this yet?

  • Premiere Freeze after videoCard Change

    In my PC, i change the video Card , from MSI GTS250 to nVidia  Quadro K4000 since that change , Premiere freeze for a few seconds when i preview a timeline I run GPUSniffer, and Adobe Premiere Recognize my new VideoCard I need some help