@@ -617,5 +617,35 @@ public void RegeneratingScopedCss_ForProjectWithReferences()
617
617
text . Should ( ) . Contain ( "background-color: orangered" ) ;
618
618
text . Should ( ) . MatchRegex ( """.*@import '_content/ClassLibrary/ClassLibrary\.[a-zA-Z0-9]+\.bundle\.scp\.css.*""" ) ;
619
619
}
620
+
621
+ [ Fact ]
622
+ public void Build_GeneratesUrlEncodedLinkHeaderForNonAsciiProjectName ( )
623
+ {
624
+ var testAsset = "RazorComponentApp" ;
625
+ var projectDirectory = CreateAspNetSdkTestAsset ( testAsset ) ;
626
+
627
+ // Create a CSS file to trigger scoped CSS processing
628
+ var cssFile = Path . Combine ( projectDirectory . Path , "Components" , "Pages" , "Index.razor.css" ) ;
629
+ Directory . CreateDirectory ( Path . GetDirectoryName ( cssFile ) ) ;
630
+ File . WriteAllText ( cssFile , ".test { color: red; }" ) ;
631
+
632
+ var build = CreateBuildCommand ( projectDirectory ) ;
633
+ // Set PackageId to contain non-ASCII characters (Chinese characters meaning "project")
634
+ ExecuteCommand ( build , "/p:PackageId=项目" ) . Should ( ) . Pass ( ) ;
635
+
636
+ var intermediateOutputPath = build . GetIntermediateDirectory ( DefaultTfm , "Debug" ) . ToString ( ) ;
637
+
638
+ // Check that the staticwebassets.build.endpoints.json file contains URL-encoded characters
639
+ var endpointsFile = Path . Combine ( intermediateOutputPath , "staticwebassets.build.endpoints.json" ) ;
640
+ new FileInfo ( endpointsFile ) . Should ( ) . Exist ( ) ;
641
+
642
+ var endpointsContent = File . ReadAllText ( endpointsFile ) ;
643
+
644
+ // Verify that the Link header contains URL-encoded characters (%E9%A1%B9%E7%9B%AE is "项目" encoded)
645
+ endpointsContent . Should ( ) . Contain ( "%E9%A1%B9%E7%9B%AE" ) ;
646
+
647
+ // Verify it doesn't contain the unencoded characters
648
+ endpointsContent . Should ( ) . NotContain ( "项目" ) ;
649
+ }
620
650
}
621
651
}
0 commit comments