Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@RequestPart 한글 깨짐 이벤트 #4

Open
leemj123 opened this issue Oct 1, 2023 · 2 comments
Open

@RequestPart 한글 깨짐 이벤트 #4

leemj123 opened this issue Oct 1, 2023 · 2 comments

Comments

@leemj123
Copy link
Owner

leemj123 commented Oct 1, 2023

Target
@RequestPart의 뭔 짓을 해도 한글 받지 못함 오류

Issues
유저 정보 변경을 위해 MultipartFile 과 String을 같이 @RequestPart로 전송 받지만 String의 한글이 깨지는 이벤트가 있다.
@PostMapping으로 바꿔봄 -> 실패
@PutMapping(consumes = "multipart/form-data;charset=UTF-8") 형식 명시 -> 실패

Solution
@ReqeustPart 대신 @ModelAttribute로 수정하고 Dto로 받기로 함

@leemj123
Copy link
Owner Author

leemj123 commented Oct 1, 2023

Add Note
@ModelAttrubute의 Dto는 @RequestPart와 다르게 'Json 직렬화' 과정이 없음으로 Dto에 @Setter 적용 필수!

@leemj123
Copy link
Owner Author

leemj123 commented Oct 1, 2023

Add Note
@ModelAttribute는 Put 보다 Post에 잘 적용된다 해서 왜 인지는 모르지만 @PostMapping으로 바꿈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant