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

  • SEARCH
  • Home
  • 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 9130887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:02:51+00:00 2026-06-17T08:02:51+00:00

UPDATED WITH SOLUTION, see at bottom Requirement : Process a ZIP file in Java

  • 0

UPDATED WITH SOLUTION, see at bottom

Requirement:
Process a ZIP file in Java SE 6 that contains files with special characters in the file names. As the encoding (of the ZIP producer) is not UTF-8, special characters get encoded. Therefore I would like to correct special characters into their proper code.

Issue:
The ZIP contains a file called abcüabc.txt .
The entry gets processed via java.util.zip.ZipEntry and when printing out single characters I see these characters (bytes):

ü gets encoded as
u followed by a
¨

Question:
So I would like to know how I can replace that u¨ into ü or maybe ue:

What I already tried and did not work out:
name.replaceAll("u\\¨", "ue");
or
name.replaceAll("ü", "ue");

Original Source Code (not working):

InputStream is = new FileInputStream(new File("/Users/me/Desktop/test.zip"));
ZipInputStream zipStream = new ZipInputStream(is);
ZipEntry zipEntry = null;
while ((zipEntry = zipStream.getNextEntry()) != null) {
    String name = zipEntry.getName(); // reading abcüabc.txt
    System.out.println("pos 3: "+name.charAt(3));
    System.out.println("pos 4: "+name.charAt(4));
    System.out.println("is equal to ¨: "+Character.toString(name.charAt(4)).equals("¨"));
}        

Output:

pos 3: u
pos 4:¨
is equal to ¨: false

Notes on my environment:

Zip produced under Mac OS X 10.6.8
Java SE 6: Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

SOLUTION

Obviously, the ZIP producer (in my case Mac OSX) converts special characters into a decomposed format. So a ü gets decomposed into u¨.
While extracting the file names form the ZIP, we would like to convert back from the decomposed to the composed format, so we only have to insert a normalization into our source code from above:

InputStream is = new FileInputStream(new File("/Users/me/Desktop/test.zip"));
ZipInputStream zipStream = new ZipInputStream(is);
ZipEntry zipEntry = null;
while ((zipEntry = zipStream.getNextEntry()) != null) {
    String name = zipEntry.getName(); // reading abcüabc.txt
    System.out.println("pos 3: "+name.charAt(3));
    System.out.println("pos 4: "+name.charAt(4));
    System.out.println("contains ü: "+name.contains("ü"));
    name = Normalizer.normalize(name, Form.NFC);
    System.out.println("contains ü: "+name.contains("ü"));
}        

Output:

pos 3: u
pos 4:¨
contains ü: false
contains ü: true
  • 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-06-17T08:02:52+00:00Added an answer on June 17, 2026 at 8:02 am

    That’s not a ¨ (U+00A8 DIAERESIS), but the U+0308 COMBINING DIAERESIS.

    The character is splitted this way because Mac Os stores file names in the Normalization Form D, which Decomposes characters like this.

    You can compose it back like so:

    String name = zipEntry.getName(); 
    name = Normalizer.normalize(name, Form.NFC);
    

    More about normalization forms

    The difference between the diaeresises is how they modify or don’t modify the previous base character:

        System.out.println( "u" + (char)0xA8); //u¨
        System.out.println( "u" + (char)0x0308); //ü
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update Solution Found See Bottom of post if interested Seems simple enough and for
See the solution at the bottom of the question. IE 8 (and lower) does
+++ It is working - See solution at bottom +++ I am a relative
IMPORTANT: updated with solution! See JAXB 2.x with MOXy (Eclipselink 2.1.2): persisting XHTML as
Update: This issue is caused by bad memory usage, see solution at the bottom.
Update: I've added an answer that describes my final solution (hint: the single Expr
Say, there is a bar that is styled at the bottom of the viewport,
UPDATE: I have installed via 'homebrew' and updated (see comments to this question), so
update at the bottom There are 4 divs that are set to look like
[Update: Problem solved! See bottom of the post] I need to allow python developers

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.