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

[Windows] Unicode path issue #85

Closed
kaedroho opened this issue Nov 2, 2016 · 3 comments · Fixed by #319 or #551
Closed

[Windows] Unicode path issue #85

kaedroho opened this issue Nov 2, 2016 · 3 comments · Fixed by #319 or #551

Comments

@kaedroho
Copy link
Contributor

kaedroho commented Nov 2, 2016

On Windows, creating a database with unicode characters in the filename creates two directories: an empty one with the correct name, and one with the actual database in it but with a mangled name.

For example:

DB::open_default("_rust_rocksdb_u͔n͈̰̎i̙̮͚̦c͚̉o̼̩̰͗d͔̆̓ͥé");

Creates two folders:

  • _rust_rocksdb_u͔n͈̰̎i̙̮͚̦c͚̉o̼̩̰͗d͔̆̓ͥé (empty)
  • _rust_rocksdb_uÍ”n͈̰̎i̙̮͚̦c͚̉o̼̩̰͗d͔̆̓ͥeÌ (with data inside it)

Linux works as expected (creates one folder with correct name)

@kaedroho
Copy link
Contributor Author

kaedroho commented Nov 2, 2016

https://github.com/spacejam/rust-rocksdb/blob/cff724a070b0dcf3b0fbf0a6aad32304973b7397/src/rocksdb.rs#L318-L336

Looks like the issue is the open method passes the UTF-8 string into RocksDB, but Windows uses UTF-16.

It's converting it into a Path to create the folder before creating the database (hence the correctly named empty folder).

[edit] more info: http://stackoverflow.com/questions/29590943/how-to-convert-a-path-into-a-const-char-for-ffi

I'll get to work on a fix.

@kaedroho
Copy link
Contributor Author

kaedroho commented Nov 2, 2016

It looks like RocksDB uses ANSI encoded strings for filenames in Windows so unicode paths aren't possible at the moment. so I'll close this for now.

@kaedroho kaedroho closed this as completed Nov 2, 2016
@spacejam
Copy link
Member

spacejam commented Nov 2, 2016

Thanks for the heads up!

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