Java 使用Http请求和UTF-8下载文件

Java 使用Http请求和UTF-8下载文件,java,http,https,Java,Http,Https,我写了这样的代码 URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("Cache-Control", "no-cache"); int responseCode = con.g

我写了这样的代码

        URL obj = new URL(url);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();


        con.setRequestMethod("GET");

        con.setRequestProperty("Cache-Control", "no-cache");


        int responseCode = con.getResponseCode();



            InputStream inputStream = con.getInputStream();
                FileOutputStream outputStream = new       FileOutputStream("C:\\aaaa\\ww.csv");

                int bytesRead = -1;
            byte[] buffer = new byte[4096];
            while ((bytesRead = inputStream.read(buffer)) != -1) {
                outputStream.write(buffer, 0, bytesRead);
            }

            outputStream.close();
            inputStream.close();
代码运行良好。我发送请求,ı可以将csv文件下载到我的计算机中。但ı想知道,如果csv文件有土耳其语字符(ş,ı,ı),则可以ı下载带有该字符的csv


或者,您可以做些什么来让这些字符在csv文件中看到它们。

服务器向您发送一个字节流,您只需将字节流保存在磁盘上,这样您就不必担心字符了。

您尝试过使用土耳其语字符吗?会发生什么?使用浏览器请求文档与您的代码之间是否存在差异?响应中的内容类型和字符编码头的值是什么?它是什么样的服务器?你拥有服务器吗?