Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for issue 618: Decks with Japanese names.

Issue 618: Ankidroid does not display deck titles with Japanese names
and fails to sync said decks.

As it turns out, the behavior of Anki on the desktop is different for
shared and personal decks.

Shared decks are limited to 40 characters and remove all but basic
characters from the file name.

Personal decks, on the other hand, are not stripped at all, to make sure
they can be synced correctly.

This makes AnkiDroid more consistent with Anki on the desktop, and
should make both shared and personal decks download work as expected.
  • Loading branch information...
commit e65eba5ceec3b64109f8d362f55dfd1671e4aec6 1 parent a35fddd
@flerda flerda authored
View
3  src/com/ichi2/anki/Download.java
@@ -54,9 +54,6 @@ public Download(String title) {
// The deck file name should match the deck title, but some characters are invalid in it,
// so they need to be replaced.
mFilename = Utils.removeInvalidDeckNameCharacters(mTitle);
- if (mFilename.length() > 40) {
- mFilename = mFilename.substring(0, 40);
- }
}
View
2  src/com/ichi2/anki/SharedDeck.java
@@ -58,6 +58,8 @@ public String getTitle() {
public void setTitle(String title) {
+ title = title.replaceAll("[^][A-Za-z0-9 ()\\-]", "");
+ title = title.substring(0, 40);
mTitle = title;
put("title", mTitle);
}
View
2  src/com/ichi2/anki/Utils.java
@@ -1054,7 +1054,7 @@ public static String removeInvalidDeckNameCharacters(String name) {
if (name == null) { return null; }
// The only characters that we cannot absolutely allow to appear in the filename are the ones reserved in some
// file system. Currently these are \, /, and :, in order to cover Linux, OSX, and Windows.
- return name.replaceAll("[^A-Za-z0-9 ()\\-]", "");
+ return name.replaceAll("[:/\\]", "");
}
/** Returns a list of files for the installed custom fonts. */
Please sign in to comment.
Something went wrong with that request. Please try again.