-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.10
-
Component/s: mongodump
-
None
In my database, some of the table is named in Chinese, when I use mongodump export these tables, mongodump reported "Failed: "rrkd_activity.coupon_receive_支付宝迎新" contains a path separator '支' and can't be dumped to the filesystem.
After my analysis, this error occurred in the checkStringForPathSeparator () function of mongodump.
func checkStringForPathSeparator(s string, c *rune) bool { for _, *c = range s { if os.IsPathSeparator(uint8(*c)) { return true } } return false }
In this function, we call IsPathSeparator () function to determine if the character contains the path separator, but if c is a Chinese, such as "支", his unicode is encoded as \u652f, If only intercepted 8 bits, it coincides with the code of "/", so the "支" is misjudged as the path separator.
The following is the test program:
func main() { var c rune c = '支' println(c) println(uint8(c)) c = '/' println(c) }
The result is:
25903
47
47
- duplicates
-
TOOLS-1163 mongodump/restore mongoexport/import and slashes in collection names
- Closed