Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5998633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:26:02+00:00 2026-05-23T00:26:02+00:00

I am facing an encoding problem (I guess) when I try to upload a

  • 0

I am facing an encoding problem (I guess) when I try to upload a file with file name having swedish charachters Ӧ Ӓ å. Applet works fine when I upload a file on Windows but not on Mac OS.

The filename gets messed up when print it on the server side, which is a Domino server, and shows boxes on Mac but When I set the encoding to UTF-8 by new String(filename.getBytes("utf-8")) it shows ? on both Win and Mac.

UPDATED:

Following are the code snippets:

Setting the request params and posting

...
request.setParameter("Name", tmpAtt.getFileName());
...

HttpURLConnection connection ...
connection.setRequestProperty("Content-Type", "multipart/form-data; charset=UTF-8; boundary=" + boundary);

if (os == null) os = connection.getOutputStream();

Setting param for filename and Inputstream

request.setParameter(fileUploadFieldName, tmpAtt.getFilePath(), fi);

public void setParameter(String name, String filename, InputStream is) throws IOException {
    boundary();
    writeName(name);
    write("; charset=utf-8; filename=\"");
    write(filename);
    write('"');
    newline();
    write("Content-Type:");
    String type = connection.guessContentTypeFromName(filename);
    if (type == null) type = "application/octet-stream";
    writeln(type);
    newline();
    pipe(is, os);
    newline();
}

At the end posting to the server

public InputStream post() throws IOException {
    boundary();
    writeln("--");
    printOS(os);
    os.close();
    InputStream iis = connection.getInputStream();
    printIS(iis);
    return iis;
}

Getting this output when writing the bytes on OutputStream to send the request. And name looks fine to me.

------------------------------hxre3intl6yy-17eufpccwtxc89pbvyg0iwe3i
Content-Disposition: form-data; name="Name

Räpörå.log
------------------------------hxre3intl6yy-17eufpccwtxc89pbvyg0iwe3i
Content-Disposition: form-data; name="Name2


------------------------------hxre3intl6yy-17eufpccwtxc89pbvyg0iwe3i
Content-Disposition: form-data; name="APPROVALSTATUS

What could be the problem.

thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:26:03+00:00Added an answer on May 23, 2026 at 12:26 am

    Java strings are always internally encoded as UTF-16, but this is not relevant to your problem, and the attempt to “set the encoding” of a string is inherently wrong.

    Encodings are used to translate between Strings and bytes. Your problem is that at some point where this is done, you are not specifying an encoding, so Java uses the platform default encoding.

    Since the filesystem API is String-based, the problem cannot be at that end, so the filename String is probably corruped at the point where you retrieve it from the user – or because there is another instance of wrongly and pointlessly trying to “set the encoding” of a Java String.

    The encoding settings in eclipse are only relevant for your source code or other files that are part of your project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing problem with an Oracle Query in a .net 2.0 based windows
I am facing a problem with .NET generics. The thing I want to do
I'm facing a problem with IE6. I took the toggle function from this website
I am facing strange issue on Windows CE: Running 3 EXEs 1)First exe doing
I am facing a problem. I would like to localize my action names in
I'm facing a real problem in understanding how to draw a variable diagram to
I'm facing a problem while unit testing my forms. The problem is that data
I have a public facing website that has been receiving a number of SQL
I am facing an application designed to import huge amounts of data into a
I am facing an application that uses hashing, but I cannot still figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.