File tree 4 files changed +17
-7
lines changed
4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ private static function isQuotedName(string $name)
139
139
*/
140
140
private static function isValidName (string $ name )
141
141
{
142
- return Regex::matches ('~\A[a-zA-Z0-9_ .]+\z~ ' , $ name )->success ()->getOrElse (false );
142
+ return Regex::matches ('~(*UTF8) \A[\p{Ll}\p{Lu}\p{M}\p{N}_ .]+\z~ ' , $ name )->success ()->getOrElse (false );
143
143
}
144
144
145
145
/**
Original file line number Diff line number Diff line change @@ -335,6 +335,14 @@ public function testEmptyLoading()
335
335
self ::assertSame (['EMPTY_VAR ' => null ], $ dotenv ->load ());
336
336
}
337
337
338
+ public function testUnicodeVarNames ()
339
+ {
340
+ $ dotenv = Dotenv::createImmutable (self ::$ folder , 'unicodevarnames.env ' );
341
+ $ dotenv ->load ();
342
+ self ::assertSame ('Skybert ' , $ _SERVER ['AlbertÅberg ' ]);
343
+ self ::assertSame ('2022-04-01T00:00 ' , $ _SERVER ['ДатаЗакрытияРасчетногоПериода ' ]);
344
+ }
345
+
338
346
public function testDirectConstructor ()
339
347
{
340
348
$ repository = RepositoryBuilder::createWithDefaultAdapters ()->make ();
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ public function testNullParse()
24
24
$ this ->checkEmptyResult ($ result , 'FOO ' );
25
25
}
26
26
27
+ public function testUnicodeNameParse ()
28
+ {
29
+ $ result = EntryParser::parse ('FOOƱ=BAZ ' );
30
+ $ this ->checkPositiveResult ($ result , 'FOOƱ ' , 'BAZ ' );
31
+ }
32
+
27
33
public function testQuotesParse ()
28
34
{
29
35
$ result = EntryParser::parse ("FOO= \"BAR \n\"" );
@@ -139,12 +145,6 @@ public function testParseInvalidName()
139
145
$ this ->checkErrorResult ($ result , 'Encountered an invalid name at [FOO_ASD!]. ' );
140
146
}
141
147
142
- public function testParseUnicodeName ()
143
- {
144
- $ result = EntryParser::parse ('FOOƱ=BAZ ' );
145
- $ this ->checkErrorResult ($ result , 'Encountered an invalid name at [FOOƱ]. ' );
146
- }
147
-
148
148
public function testParserEscapingDouble ()
149
149
{
150
150
$ result = EntryParser::parse ('FOO_BAD="iiiiviiiixiiiiviiii \\a" ' );
Original file line number Diff line number Diff line change
1
+ AlbertÅberg=Skybert
2
+ ДатаЗакрытияРасчетногоПериода='2022-04-01T00:00'
You can’t perform that action at this time.
0 commit comments