File tree Expand file tree Collapse file tree
src/main/java/com/atomgraph/linkeddatahub/resource/upload Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919import java .io .File ;
2020import java .io .FileNotFoundException ;
2121import java .net .URI ;
22+ import java .nio .charset .StandardCharsets ;
2223import java .util .List ;
2324import jakarta .ws .rs .core .Context ;
2425import jakarta .ws .rs .core .Request ;
@@ -282,8 +283,16 @@ public jakarta.ws.rs.core.MediaType getMediaType()
282283 if (log .isErrorEnabled ()) log .error ("File '{}' does not have a media type" , getResource ());
283284 throw new IllegalStateException ("File does not have a media type (dct:format)" );
284285 }
285-
286- return com .atomgraph .linkeddatahub .MediaType .valueOf (format );
286+
287+ jakarta .ws .rs .core .MediaType mediaType = com .atomgraph .linkeddatahub .MediaType .valueOf (format );
288+
289+ // Add charset=UTF-8 for text-based media types
290+ if (mediaType .getType ().equals ("text" ))
291+ {
292+ return mediaType .withCharset (StandardCharsets .UTF_8 .name ());
293+ }
294+
295+ return mediaType ;
287296 }
288297
289298 /**
You can’t perform that action at this time.
0 commit comments