1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

Bug 480407 - Arduino Yún name is mangled in the UI

Chain the FileReader (which uses default character encoding) with an InputStreamReader in order to force UTF-8 encoding

Change-Id: Ia32c079a18f580e36f1629182bfb829ab8f71c71
Signed-off-by: Benjamin Cabé <benjamin@eclipse.org>
This commit is contained in:
Benjamin Cabé 2015-10-22 13:22:36 +02:00
parent 8cc9e5f3f0
commit fabc2a02b9

View file

@ -9,8 +9,11 @@ package org.eclipse.cdt.arduino.core.internal.board;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.net.URL;
@ -102,7 +105,9 @@ public class ArduinoPlatform {
public List<ArduinoBoard> getBoards() throws CoreException {
if (isInstalled() && boardsProperties == null) {
Properties boardProps = new Properties();
try (Reader reader = new FileReader(getInstallPath().resolve("boards.txt").toFile())) { //$NON-NLS-1$
try (InputStream is = new FileInputStream(getInstallPath().resolve("boards.txt").toFile());
Reader reader = new InputStreamReader(is, "UTF-8")) { //$NON-NLS-1$
boardProps.load(reader);
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.getId(), "Loading boards.txt", e)); //$NON-NLS-1$