| |

VerySource

 Forgot password?
 Register
Search
View: 775|Reply: 8

Ask for help

[Copy link]

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-26 21:20:01
| Show all posts |Read mode
Image URLs cannot be read if they contain Chinese, such as http://test.com/test/test.jpg
Is there a way to solve it?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-19 00:45:01
| Show all posts
I do n’t know if there is a way to solve this, but it ’s better to change the file name to English for convenience.
Reply

Use magic Report

0

Threads

73

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Invalid IP Address

Post time: 2020-2-19 15:00:01
| Show all posts
The answer should be "there must be a solution", although I can't say it in one go.
But I suggest you change to English.
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-19 20:00:01
| Show all posts
Because it is uploading, the folder name can be taken by yourself. XX requires that Chinese must be supported. . . . . .
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Invalid IP Address

Post time: 2020-2-19 23:15:01
| Show all posts
Compile this class
package com.group;
import java.io. *;
import javax.servlet. *;
import javax.servlet.http. *;

public class EncodingFilter implements Filter {
public void init (FilterConfig filterConfig)
          throws ServletException {
    }
    
    public void doFilter (ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws java.io.IOException, ServletException {
    request.setCharacterEncoding ("GBK");
    chain.doFilter (request, response);
}
Ranch
public void destroy () {
}
}
Then add it in web-xml
<filter>
  <filter-name> encode </ filter-name>
  <filter-class> com.group.EncodingFilter </ filter-class>
</ filter>
<filter-mapping>
  <filter-name> encode </ filter-name>
  <url-pattern> / * </ url-pattern>
</ filter-mapping>
In this way, you can wait until the encoding set becomes Chinese, which should solve your problem
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-20 12:00:01
| Show all posts
Ok thank youzhouyongzun, let me try
Reply

Use magic Report

0

Threads

73

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Invalid IP Address

Post time: 2020-2-20 13:45:01
| Show all posts
Is the upload successful and the read failed?
Have you ever tried URL encoding? Replace those two Chinese characters with URL encoding. You can use java.net.URLEncoder.
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-21 03:00:02
| Show all posts
Yes, the upload failed to read successfully, I tried URLEncoder.
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-21 20:45:01
| Show all posts
Or not
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list