I am working on a Mac app, just a simple web application encapsulated in WKWebView.
Here is the code when I tring to upload a file which name contains special character:
-(void)webView:(WKWebView *)webView runOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * _Nullable))completionHandler
{
DEBUG_FUNC(@"");
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
[openDlg setPrompt:NSLocalizedString(@"Choose", nil)];
openDlg.allowsMultipleSelection = YES;
if ( [openDlg runModal] == NSOKButton )
{
if (completionHandler)
{
completionHandler([openDlg URLs]);
}
}
}
When I was using WebView, this way can work, so it should not be a web problem.
But since the project used WKWebView,
for example: file "证书.p12" would be changed to "è¯ä¹¦.p12" after uploaded via WKWebView.
Anyone know how to solve it?
Thanks!