on 04-26-2007 9:03 AM
Hi,all
I need to replace the hebrew filename by english or numeric filename
befor I upload it to KM,couse I have problem with hebrew filename
when I'm trying to open it from the portal.How can I do such replacement,i.e.
first of all I how can I know that the filename is in hebrew?
Regards,
Michael
Michael,
First part is simple.
Check http://unicode.org/charts/PDF/U0590.pdf
Hebrew Unicode range is 0x0590 -- 0x05FF.
So you may check chars in string to see whether or not they are from Hebrew (just compare Character.getNumericValue(char ch) with range of integers above).
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Michael,
Code that detect existence of Hebrew chars could be like this:
final String path = wdContext.currentContextElement().getFilePath();
boolean hasHebrewChars = false;
for (int i = 0, size = path.length(); i < size; i++) {
final char ch = path.charAt(i);
if ( ch >= 0x0590 && ch <= 0x05FF) {
hasHebrewChars = true;
break;
}
}
Valery Silaev
SaM Solutions
Michael,
Any solutions is good if it works for you
What is your definition of "more elegant"? I can guess only 2 possibilities:
-- replace only Hebrew (or any non-ASCII) characters but not English characters if any.
-- escape characters rather then replace them, so it is possible to recover original name later; however this will increase length of string, so it's easy to hit limits of max. alowed length for string, also this will require escaping of escape character and will affect names of all files.
Valery Silaev
SaM Solutions
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.