Comments (20)
Well, MMKV uses id as filename. For the time being, just don't do this.
from mmkv.
Why not Hash Code or MD5
from mmkv.
Why not Hash Code or MD5
It's already shipped. Now is too late for that. That's why.
from mmkv.
Why not Hash Code or MD5
It's already shipped. Now is too late for that. That's why.
Is it possible to encode only special characters?
from mmkv.
Is it possible to encode only special characters?
Or just throw exception on bad id?
Encoding special char is always complicated. Say you replaces /
with _
, now how do you handle normal _
? With __
? Now don't forget there may already be some id that has an _
, how do you handle old id?
from mmkv.
Is this related to Android
? I don't familiar with it, butI think we can find the issue character and just encode it, the way like encodeURI
which transform certain characters using escape sequences.
from mmkv.
Is this related to
Android
? I don't familiar with it, butI think we can find the issue character and just encode it, the way likeencodeURI
which transform certain characters using escape sequences.
No. It has nothing to do with Android. All those ecodeXXX
has the same problem I described before: they don't support backward compatibility.
from mmkv.
Is it possible to encode only special characters?
Or just throw exception on bad id?
Fixed with commit.
from mmkv.
from mmkv.
Hmm...
from mmkv.
No. It has nothing to do with Android. All those ecodeXXX has the same problem I described before: they don't support backward compatibility.
No backward compatible? I think it compatible, previously it would crash, after encode specific char, it works.
from mmkv.
No backward compatible? I think it compatible, previously it would crash, after encode specific char, it works.
Encoding special char is always complicated. Say you replaces / with _, now how do you handle normal _? With __? Now don't forget there may already be some id that has an _, how do you handle old id?
Had I not been clear? Those encodeXXX algorithms, no matter which char(s) they choose to escape, are choosing valid chars to escape with. And how do they handle these valid chars themself? They do double escape. That's where the No backward compatible happens.
from mmkv.
@lingol First, scan the mmkvID
, if it exist special character (which leads to crash), encode it and using a separate sub-directory in directory mmkv
to store these files which have special characters. If it not have special character, keep the regular way.
from mmkv.
Say we replace /
with _
.
Given test/hello2
, we get test_hello2
, right? Everything goes well. Except if there is some one already create a MMKV instance with test_hello2
.
Now tell me, how do you handle this collision?
from mmkv.
@lingol Emm, maybe you don't get what I point 😂 . I'll explain further, as your example, if given test/hello2
, we find it contains special character /
, so we encode it to test_hello2
, and besides this, we add a separate subdirectory to store the file, so file would be stored in mmkv/special-character/
directory (PS. for id
which not contains special character, we still store the files in mmkv/
directory). So no collision would be happen.
from mmkv.
from mmkv.
@zhongwuzw That might just work. Would you like to write a pr?
from mmkv.
@lingol Yeah, I can, but firstly, I need to confirm something because I'm not familiar Android
, the reason which causes crash is the file cannot created? because intermediate directories not exist if id
contains /
? If it is, I think we only need to modify implementation mappedKVPathWithID and crcPathWithID, and judge wether contains /
, if existed, encode it and create a separate sub-directory, am I right?
from mmkv.
@zhongwuzw Not just /
.
from mmkv.
Release with v1.0.13.
from mmkv.
Related Issues (20)
- Cheers! How to start to add #import <MMKV/MMKV.h> to my source file? HOT 2
- flutter use mmkv:1.3.0 , android application destory HOT 3
- crashed in Harmony Next Emulator API 11 x86_64 HOT 15
- minsdk 23 bump HOT 5
- The MMKV for HarmonyOS NEXT version lacks the interface for parsing the float type. HOT 17
- POSIX平台构建demo程序时报错 HOT 3
- MMKV for HarmonyOS NEXT 是否可以提供自定义对象的存取接口? HOT 4
- 多进程模式使用问题 HOT 1
- 在 HarmonyOS NEXT API 11 上初始化,发生崩溃,版本 : @tencent/mmkv":"1.3.5" HOT 1
- Fail to find any mmkv plugin dependencies HOT 3
- MMKV failed to build on iOS v1.3.5 HOT 4
- 一直有错误信息打印 HOT 1
- Query related to encryption key size increase HOT 1
- ohos中json字符串末尾分号丢失 HOT 4
- 鸿蒙 ide版本 Build Version: 5.0.3.100 api12 初始化的时候必现sysFreeze HOT 4
- MMKV crash (report from bugly) HOT 1
- Importing ArkTS files to JS and TS files is not allowed. <ArkTSCheck> HOT 4
- 鸿蒙导入MMKV初始化崩溃 HOT 3
- Thread 1: "MMKV not initialized properly, must call +initializeMMKV: in main thread before calling any other MMKV methods" HOT 16
- 鸿蒙版本存入字符串和取出字符串不匹配 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mmkv.