File tree 4 files changed +16
-2
lines changed
main/java/io/github/cdimascio/dotenv/internal
4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,12 @@ static Stream<String> loadFileFromClasspath(String location) {
25
25
throw new DotenvException ("Could not find " +location +" on the classpath" );
26
26
}
27
27
28
- final var scanner = new Scanner (inputStream , StandardCharsets . UTF_8 );
28
+ final var scanner = new Scanner (inputStream , "utf-8" );
29
29
final var lines = new ArrayList <String >();
30
30
while (scanner .hasNext ()) {
31
31
lines .add (scanner .nextLine ());
32
32
}
33
-
33
+ scanner . close ();
34
34
return lines .stream ();
35
35
}
36
36
}
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class BasicTests {
20
20
put ("QUOTED_VALUE" , "iH4>hb_d0#_GN8d]6" );
21
21
put ("MY_TEST_EV4" , "my test ev 4" );
22
22
put ("MULTI_LINE_WITH_SHARP" , "hello\n #world" );
23
+ put ("UTF8_STRING" , "äöüßé😀" );
23
24
}};
24
25
25
26
@ Test
@@ -135,6 +136,15 @@ void iterateOverDotenv() {
135
136
assertEquals (dotenv .get (e .getKey ()), e .getValue ());
136
137
}
137
138
}
139
+
140
+ @ Test
141
+ void iterateOverEnvVar () {
142
+ final var dotenv = Dotenv .configure ()
143
+ .ignoreIfMalformed ()
144
+ .load ();
145
+
146
+ envVars .forEach ((key , expected ) -> assertEquals (expected , dotenv .get (key )));
147
+ }
138
148
139
149
@ Test
140
150
void dotenvMissing () {
Original file line number Diff line number Diff line change @@ -24,3 +24,5 @@ QUOTED_EV1="jdbc:hive2://[domain]:10000/default;principal=hive/_HOST@[REALM]"
24
24
25
25
# # Test ENV that is expected to be overriden by HOME in host env
26
26
HOME = dotenv_test_home
27
+
28
+ UTF8_STRING = " äöüßé😀"
Original file line number Diff line number Diff line change @@ -19,3 +19,5 @@ MISSING_START_QUOTE=teste"
19
19
MY_TEST_EV4="my test ev 4"
20
20
MULTI_LINE_WITH_SHARP="hello
21
21
#world"
22
+
23
+ UTF8_STRING="äöüßé😀"
You can’t perform that action at this time.
0 commit comments