Skip to main content
added 1 character in body; edited title
Source Link
marc_s
  • 759.9k
  • 186
  • 1.4k
  • 1.5k

undertow Undertow FileUtil cut of UTF-8 characters and concatenate the two half charachtercharacter as a character

If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold thanMultipartConfigElement.fileSizeThreshold, then my post is out of a temporary file. Undertow FileUtils read it so:

 public static String readFile(InputStream file, Charset charSet) {   try (BufferedInputStream stream = new BufferedInputStream(file)) {   byte[] buff = new byte[1024];   StringBuilder builder = new StringBuilder();   int read;   while ((read = stream.read(buff)) != -1) {   builder.append(new String(buff, 0, read, charSet));   }   return builder.toString();   } catch (IOException e) {   throw new RuntimeException(e);   }  } 

If I understand this good, this code can cut in two slice one UTF-8 non-English Charactercharacter and concat it as two bad character.

támogat��s

támogat��s 

I hava 'á'have a á character and now two bad...

What is the best solution of this problem?

a, undertow jira ticket b, Increase treshold size? c, Leave multipart if it is possible (i think not)

  • Undertow jira ticket
  • Increase treshold size?
  • Leave multipart if it is possible (I think not)

HaveDoes somebody have any experience ofwith this?

Thanks a lot. H.

undertow FileUtil cut of UTF-8 characters and concatenate the two half charachter as a character

If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold than my post is out of a temporary file. Undertow FileUtils read it so:

 public static String readFile(InputStream file, Charset charSet) {   try (BufferedInputStream stream = new BufferedInputStream(file)) {   byte[] buff = new byte[1024];   StringBuilder builder = new StringBuilder();   int read;   while ((read = stream.read(buff)) != -1) {   builder.append(new String(buff, 0, read, charSet));   }   return builder.toString();   } catch (IOException e) {   throw new RuntimeException(e);   }  } 

If I understand this good, this code can cut in two slice one UTF-8 non-English Character and concat it as two bad character.

támogat��s

I hava 'á' character and now two bad...

What is the best solution of this problem?

a, undertow jira ticket b, Increase treshold size? c, Leave multipart if it is possible (i think not)

Have somebody experience of this?

Thanks a lot. H.

Undertow FileUtil cut of UTF-8 characters and concatenate the two half character as a character

If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold, then my post is out of a temporary file. Undertow FileUtils read it so:

public static String readFile(InputStream file, Charset charSet) { try (BufferedInputStream stream = new BufferedInputStream(file)) { byte[] buff = new byte[1024]; StringBuilder builder = new StringBuilder(); int read; while ((read = stream.read(buff)) != -1) { builder.append(new String(buff, 0, read, charSet)); } return builder.toString(); } catch (IOException e) { throw new RuntimeException(e); } } 

If I understand this good, this code can cut in two slice one UTF-8 non-English character and concat it as two bad character.

támogat��s 

I have a á character and now two bad...

What is the best solution of this problem?

  • Undertow jira ticket
  • Increase treshold size?
  • Leave multipart if it is possible (I think not)

Does somebody have any experience with this?

Thanks a lot. H.

Source Link

undertow FileUtil cut of UTF-8 characters and concatenate the two half charachter as a character

If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold than my post is out of a temporary file. Undertow FileUtils read it so:

 public static String readFile(InputStream file, Charset charSet) { try (BufferedInputStream stream = new BufferedInputStream(file)) { byte[] buff = new byte[1024]; StringBuilder builder = new StringBuilder(); int read; while ((read = stream.read(buff)) != -1) { builder.append(new String(buff, 0, read, charSet)); } return builder.toString(); } catch (IOException e) { throw new RuntimeException(e); } } 

If I understand this good, this code can cut in two slice one UTF-8 non-English Character and concat it as two bad character.

támogat��s

I hava 'á' character and now two bad...

What is the best solution of this problem?

a, undertow jira ticket b, Increase treshold size? c, Leave multipart if it is possible (i think not)

Have somebody experience of this?

Thanks a lot. H.