TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Content-Disposition"]
Answered
Mini Rex posted this in #help-forum
Mini RexOP
This error occurs when I try to set the filename in the "Content-Disposition" header to some Chinese characters. Is there a way to encode this filename properly?
Answered by joulev
You can use encodeURI/decodeURI, or something like [content-disposition](https://github.com/jshttp/content-disposition)
4 Replies
@Mini Rex This error occurs when I try to set the filename in the "Content-Disposition" header to some Chinese characters. Is there a way to encode this filename properly?
You can use encodeURI/decodeURI, or something like [content-disposition](https://github.com/jshttp/content-disposition)
Answer
@joulev You can use encodeURI/decodeURI, or something like [content-disposition](https://github.com/jshttp/content-disposition)
Mini RexOP
is encodeURI supported within nextapi routes by default?
@Mini Rex is encodeURI supported within nextapi routes by default?
Yes encodeURI/decodeURI is part of JavaScript and is available everywhere
Mini RexOP
thanks a lot for the help, marking above as solution