Source:
<code>public ResponseEntity<?> searchPackages(@ApiParam(value = "The storageId", required = true) @PathVariable(name = "storageId") String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable(name = "repositoryId") String repositoryId, @RequestParam(name = "$filter", required = true) String filter, @RequestParam(name = "$orderby", required = false, defaultValue = "updated") String orderBy, @RequestParam(name = "$skip", required = false, defaultValue = "0") int skip, @RequestParam(name = "$top", required = false, defaultValue = "-1") int top, @RequestParam(name = "searchTerm", required = true) String searchTerm, @RequestParam(name = "targetFramework", required = true) String targetFramework) throws JAXBException { Lexer queryLexer = new QueryLexer(); Expression expression; try { expression = queryLexer.parse(filter); } catch (NugetFormatException e) { return ResponseEntity.badRequest().build(); } PackageSource<Nupkg> packageSource = new NugetSearchPackageSource(expression); Collection<? extends Nupkg> files = getPackages(packageSource, filter, normaliseSearchTerm(searchTerm), targetFramework); String feedId = getFeedUri(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(), storageId, repositoryId); NuPkgToRssTransformer toRssTransformer = new NuPkgToRssTransformer(feedId); PackageFeed feed = toRssTransformer.transform(files, orderBy, skip, top); ByteArrayOutputStream rssResultStream = new ByteArrayOutputStream(); feed.writeXml(rssResultStream); <START> return new ResponseEntity<>(new String(rssResultStream.toByteArray()), HttpStatus.OK); <END> }</code><technical_language>I recommend UTF-8, if possible</technical_language>

Target:
public ResponseEntity<?> searchPackages(@ApiParam(value = "The storageId", required = true) @PathVariable(name = "storageId") String storageId, @ApiParam(value = "The repositoryId", required = true) @PathVariable(name = "repositoryId") String repositoryId, @RequestParam(name = "$filter", required = true) String filter, @RequestParam(name = "$orderby", required = false, defaultValue = "updated") String orderBy, @RequestParam(name = "$skip", required = false, defaultValue = "0") int skip, @RequestParam(name = "$top", required = false, defaultValue = "-1") int top, @RequestParam(name = "searchTerm", required = true) String searchTerm, @RequestParam(name = "targetFramework", required = true) String targetFramework) throws JAXBException { Lexer queryLexer = new QueryLexer(); Expression expression; try { expression = queryLexer.parse(filter); } catch (NugetFormatException e) { return ResponseEntity.badRequest().build(); } PackageSource<Nupkg> packageSource = new NugetSearchPackageSource(expression); Collection<? extends Nupkg> files = getPackages(packageSource, filter, normaliseSearchTerm(searchTerm), targetFramework); String feedId = getFeedUri(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(), storageId, repositoryId); NuPkgToRssTransformer toRssTransformer = new NuPkgToRssTransformer(feedId); PackageFeed feed = toRssTransformer.transform(files, orderBy, skip, top); ByteArrayOutputStream rssResultStream = new ByteArrayOutputStream(); feed.writeXml(rssResultStream); return new ResponseEntity<>(new String(rssResultStream.toByteArray(), Charset.forName("UTF-8")), HttpStatus.OK); }