File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -2851,6 +2851,7 @@ init_io(string input_file_name)
2851
2851
int k ;
2852
2852
unsigned char * ptr = (unsigned char * ) input_file_name ;
2853
2853
UInt32 rval ;
2854
+ bool name_needs_quotes ;
2854
2855
2855
2856
stdin_ufile .handle = NULL ;
2856
2857
stdin_ufile .savedChar = -1 ;
@@ -2862,9 +2863,19 @@ init_io(string input_file_name)
2862
2863
/* Hacky stuff that sets us up to process the input file, including UTF8
2863
2864
* interpretation. */
2864
2865
2866
+ /* Check if there is a space in the input_file_name. If so, quote it,
2867
+ * because xetex interprets space as the end of the filename. Otherwise, we
2868
+ * leave it unquoted, to maintain backwards compatibility. */
2869
+ name_needs_quotes = (strchr (input_file_name , ' ' ) != NULL );
2870
+
2865
2871
buffer [first ] = 0 ;
2866
2872
k = first ;
2867
2873
2874
+ /* If the name needs quotes, start them here. */
2875
+ if (name_needs_quotes ) {
2876
+ buffer [k ++ ] = '"' ;
2877
+ }
2878
+
2868
2879
while ((rval = * (ptr ++ )) != 0 ) {
2869
2880
UInt16 extraBytes = bytesFromUTF8 [rval ];
2870
2881
@@ -2881,7 +2892,11 @@ init_io(string input_file_name)
2881
2892
buffer [k ++ ] = rval ;
2882
2893
}
2883
2894
2884
- buffer [k ] = ' ' ;
2895
+ /* If we quoted earlier, end them here. */
2896
+ if (name_needs_quotes ) {
2897
+ buffer [k ++ ] = '"' ;
2898
+ }
2899
+ buffer [k ] = ' ' ; /* Unquoted space terminates filename for xetex engine */
2885
2900
last = k ;
2886
2901
cur_input .loc = first ;
2887
2902
cur_input .limit = last ;
You can’t perform that action at this time.
0 commit comments