XploreME!
Would you like to react to this message? Create an account in a few clicks or log in to continue.

filename problem

3 posters

Go down

filename problem Empty filename problem

Post by ericsheu Thu Oct 18, 2007 7:04 pm

xploreME! is so wonderful:D,

but it seens like have a little problem (a big problem to me😢 ),
when i use chinese character (UTF-8 format) as the filename or path (such as 音樂 )
,then the mediafile(mp3,3gp,etc..) will NOT be playable anymore,
hope you can done the support to UTF-8 filename or folder name,
thanks a lot! cheers

ericsheu

Number of posts : 2
Country : taipei
Registration date : 2007-10-18

Back to top Go down

filename problem Empty Re: filename problem

Post by ThaPhoeniX Thu Oct 18, 2007 9:59 pm

im not sure how it can be done.. it is very problematic to fix that bug, i donno what string your phone returns, ill see if i can do something about it but im doubt...
ThaPhoeniX
ThaPhoeniX
Admin

Number of posts : 387
Registration date : 2007-02-24

https://xploreme.editboard.com

Back to top Go down

filename problem Empty Re: filename problem

Post by jason.lkk Fri Oct 19, 2007 4:58 am

ThaPhoeniX wrote:im not sure how it can be done.. it is very problematic to fix that bug, i donno what string your phone returns, ill see if i can do something about it but im doubt...


I know a application call "KD Player". It supported UTF-8 format file/folder name. I have use that application on my SE K550 now.

Here is the application website: http://www.kdpro.dev.juga.ru/

Hope this can help you.

jason.lkk
Active Member

Number of posts : 10
Country : malaysia
Registration date : 2007-10-16

Back to top Go down

filename problem Empty Re: filename problem

Post by ThaPhoeniX Fri Oct 19, 2007 12:23 pm

ericsheu wrote:xploreME! is so wonderful:D,

but it seens like have a little problem (a big problem to me😢 ),
when i use chinese character (UTF-8 format) as the filename or path (such as 音樂 )
,then the mediafile(mp3,3gp,etc..) will NOT be playable anymore,
hope you can done the support to UTF-8 filename or folder name,
thanks a lot! cheers

can you the the correct names on the browser?
ThaPhoeniX
ThaPhoeniX
Admin

Number of posts : 387
Registration date : 2007-02-24

https://xploreme.editboard.com

Back to top Go down

filename problem Empty Re: filename problem

Post by ericsheu Mon Oct 22, 2007 7:54 pm

sorry for see your reply lately,

I've used KD Player before, but it has the same problem,
all songs will not be playable when named as UTF8 format,

i've searching on the web and found a similar java program,
it probably has some key can cause to the problem,
but i'm not sure where the information helpful to you or not~Neutral
following java including some simplified chinese character,
it's just a remark section, you can ignore it...


  1. public static String getAppPath(Class cls){
  2. //检查用户传入的参数是否为空
  3. if(cls==null) </SPAN>
  4. throw new java.lang.IllegalArgumentException("参数不能为空!"); </SPAN>
  5. ClassLoader loader=cls.getClassLoader();
  6. //获得类的全名,包括包名 </SPAN>
  7. String clsName=cls.getName()+".class"; </SPAN>
  8. //获得传入参数所在的包 </SPAN>
  9. Package pack=cls.getPackage();
  10. String path=""; </SPAN>
  11. //如果不是匿名包,将包名转化为路径 </SPAN>
  12. if(pack!=null){ </SPAN>
  13. String packName=pack.getName();
  14. //此处简单判定是否是Java基础类库,防止用户传入JDK内置的类库 </SPAN>
  15. if(packName.startsWith("java.")||packName.startsWith("javax.")) </SPAN>
  16. throw new java.lang.IllegalArgumentException("不要传送系统类!"); </SPAN>
  17. //在类的名称中,去掉包名的部分,获得类的文件名 </SPAN>
  18. clsName=clsName.substring(packName.length()+1); </SPAN>
  19. //判定包名是否是简单包名,如果是,则直接将包名转换为路径, </SPAN>
  20. if(packName.indexOf(".")<0) path=packName+"/"; </SPAN>
  21. else{//否则按照包名的组成部分,将包名转换为路径 </SPAN>
  22. int start=0,end=0; </SPAN>
  23. end=packName.indexOf("."); </SPAN>
  24. while(end!=-1){ </SPAN>
  25. path=path+packName.substring(start,end)+"/"; </SPAN>
  26. start=end+1; </SPAN>
  27. end=packName.indexOf(".",start); </SPAN>
  28. }
  29. path=path+packName.substring(start)+"/"; </SPAN>
  30. }
  31. }
  32. //调用ClassLoader的getResource方法,传入包含路径信息的类文件名 </SPAN>
  33. java.net.URL url =loader.getResource(path+clsName);
  34. //从URL对象中获取路径信息 </SPAN>
  35. String realPath=url.getPath();
  36. //去掉路径信息中的协议名"file:" </SPAN>
  37. int pos=realPath.indexOf("file:"); </SPAN>
  38. if(pos>-1) realPath=realPath.substring(pos+5); </SPAN>
  39. //去掉路径信息最后包含类文件信息的部分,得到类所在的路径 </SPAN>
  40. pos=realPath.indexOf(path+clsName);
  41. realPath=realPath.substring(0,pos-1); </SPAN>
  42. //如果类文件被打包到JAR等文件中时,去掉对应的JAR等打包文件名 </SPAN>
  43. if(realPath.endsWith("!")) </SPAN>
  44. realPath=realPath.substring(0,realPath.lastIndexOf("/")); </SPAN>
  45. /*------------------------------------------------------------ </SPAN>
  46. ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径
  47. 中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要
  48. 的真实路径,在此,调用了URLDecoder的decode方法进行解码,以便得到原始的
  49. 中文及空格路径
  50. -------------------------------------------------------------*/
  51. try{ </SPAN>
  52. realPath=java.net.URLDecoder.decode(realPath,"utf-8"); </SPAN>
  53. }catch(Exception e){throw new RuntimeException(e);} </SPAN>
  54. return realPath; </SPAN>
  55. }//getAppPath定义结束 </SPAN>
  56. /-----------------------------------------------------------------
</SPAN>

ericsheu

Number of posts : 2
Country : taipei
Registration date : 2007-10-18

Back to top Go down

filename problem Empty Re: filename problem

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum