private int handleSpaces(String str, int i, StringBuilder out) {
		int found = 0;
		@SuppressWarnings("unused")
		int orig_i = i;
		while (i < str.length() && str.charAt(i) == ' ') {
			i++;
			found++;
		}

		if (found == 0 || i == str.length()) return 0;

		char t = str.charAt(i);
		if (tib_top(t) == null && tib_other(t) == null) return 0;

		// found 'found' spaces between two tibetan bits; generate the same number of '_'s
		for (i = 0; i < found; i++) {
			out.append('_');
		}
		return found;
	}