【fix】 解决Bulk同步中文上去时,中文格式异常问题

This commit is contained in:
Kris 2025-06-09 16:48:13 +08:00
parent 8dfee0c830
commit 2e48a9def7

View File

@ -6,6 +6,9 @@ import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig; import com.sforce.ws.ConnectorConfig;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -131,7 +134,7 @@ public class BulkUtil {
throws IOException, AsyncApiException { throws IOException, AsyncApiException {
List<BatchInfo> batchInfos = new ArrayList<BatchInfo>(); List<BatchInfo> batchInfos = new ArrayList<BatchInfo>();
BufferedReader rdr = new BufferedReader( BufferedReader rdr = new BufferedReader(
new InputStreamReader(new FileInputStream(csvFileName)) new InputStreamReader(Files.newInputStream(Paths.get(csvFileName)),"GBK")
); );
// read the CSV header row // read the CSV header row
byte[] headerBytes = (rdr.readLine() + "\n").getBytes("UTF-8"); byte[] headerBytes = (rdr.readLine() + "\n").getBytes("UTF-8");