File name encoding at Knoppix - character-encoding

I am getting file list in my Java program using list() method of File class. When I run my program on Knoppix I get ???? instead of Cyrillic file names. It seems that problem is in knoppix, not java. I tried to use options for mounting file system, such as nls and iocharset, but it has no effect (or may be I use it in wrong way). Somebody can help me?

I think that problem is as you said with Knoppix. Probably you do not have Cyrillic font bundled, so there is no way to display these code points.
If you want to fix this, you will need fix distribution, as there is nothing wrong with the program. I am not sure if this is the question for https://serverfault.com/ or https://superuser.com/, but you can read their FAQ's and ask how to fix it there (probably you will need to re-create Knoppix distribution).

Related

How to check if a file is read only?

Neither io nor lfs seem to have an option to check for this. I need to use this feature to simulate some code that does this check.
It seems there's an undocumented permissions field in the table returned by lfs.attributes(). Thanks to #siffiejoe for pointing this out, didn't see it when I read the code.
Another approach is of course to try to read from the file, that will always work but might be slower.
You could also try opening the file and setting a (temporary, of course) read lock on it. Not sure about the portability of file locking in Lua, though.
Note: checking if a file is readable and then doing something can break due to race conditions; the permissions of a file can change between your check and the following action.

Trouble with Paths?

I have a problem where I am creating an Android app using Firemonkey in Delphi XE6. The app consists of a TWebBrowser and a button...nothing fancy.
I am TRYING to display an xhtml file that is located on my SD card.
I "think" I am doing all the right things like using "TPath.GetHomePath" and putting my file in this location. - and made sure the permissions are set in the project.
Being a seasoned developer, I know that I need to use "file://" so the browser knows it a local file, as I have done a million times in Delphi over the years, and even checking the help file which uses the example "WebBrowser1.Navigate('file://MyFile.pdf')"
So I construct my URL by doing :
AppPath := TPath.Combine(TPath.GetHomePath, 'myfile.xhtml');
I then go:
WebBrowser1.Navigate('file://'+AppPath);
When the navigation happens, it tells me the file doesn't exist, file:///data/data/com.embarcadero.WebBrowser/files/myfile.xhtml
I spotted the 3 /'s i.e. file:/// and thought I would just hard coded the path into a string and got the same problem saying the file doesn't exists and it reverting back to file:///
Can anyone see what I am doing wrong? its got me puzzled thats for sure! :-)
Thanks, Jeremy
Instead of
TPath.GetHomePath
i used
TPath.GetPublicPath
which leads me to /storage/emulated/0/Android/data/<myapp>/files/ folder (the one i need).
TPath.GetHomePath
gives me data/data/<myapp>/files/ which is not exists (i guess, maybe i need something like GetAbsolutePath).

ERROR loading files on wxMaxima [iMac]

I hope you can solve this or at least tell what to do about it because I'm clueless. The thing is that once I've saved a .wxm file and then want to open it appears on wxMaxima this error and the "app" crashes:
Maxima encountered a Lisp error:
decoding error on stream
<SB-SYS:FD-STREAM for "socket 127.0.0.1:62607, peer: 127.0.0.1:4011"
{13F30991}
(:EXTERNAL-FORMAT :ASCII):
the octet sequence (195) cannot be decoded.
Automatically continuing.
To enable the Lisp debugger set debugger-hook to nil.
Thanks in advance.
P.S.: I run the latest Mac OS X version on my iMac.
Create a new file and write it down.
(setf sb-impl::*default-external-format* :utf-8)
(setf sb-alien::*default-c-string-external-format* :utf-8)
Save the file as .sbclrc at Home (User) folder.
I come back on this post as I have been affected by this today.
I am using Ubunutu 14.04 and the same bug appears. To me it is due to Maxima not being able to load anything else than ".mac" files, nothing to do with utf-8/ASCII (I have mv a file that is working to a wxm and vice-versa, it will not work anymore / rework)
Also I have prepared a workaround:
The idea is too have a tool that translates your .wxm files to a .mac file just before you load it (it is actually a very easy bash script)
So:
you put the wxm-to-mac.sh files into your path
then inside maxima, instead of doing
load("foo.wxm")
you simply do
system("wxm-to-mac foo.wxm")$
load("foo.mac")$
Bare in mind you shall not edit the foo.mac file because a routine might re-erase it afterward. Instead keep editing the .wxm file.
Hope it helps someone
Looks like the file has been saved with some non-ASCII characters (e.g. UTF-8) in it, but it is not read as UTF-8; that seems to be a bug in wxMaxima. Can you please post the offending .wxm file?
I was having the same problem, since none here could give a straight and correct answer (at least is not marked with the green icon) i tried to look somewhere else. I couldn't find an answer that solve my problem, but then i thought that i had used WxMaxima on Mac before and it worked pretty nice. The last time i installed wxmaxima on mac and it worked was in september 2012, i went to the http://sourceforge.net website and searched for the maxima file that was available on that date and i found http://sourceforge.net/projects/maxima/files/Maxima-MacOS/5.18.1-MacOS/, i installed it and its working pretty fine (about the problem, it is weird, even if i create a new maxima file typed "a" and saved it, i could no longer open it, so i'm guessing that it has nothing to do with ascii or non-ascii characters) I have no idea why this error happens on the recent version of Maxima/WxMaxima, but it makes no sense that we have to install a previous version for it to work.
Anyway, it's working for me, and i hope it works for you too. Glad i helped :)
I had the same problem.
In my case, the name of the directory where the ".wxm" file is located, contained Korean letter. I changed the directory name with an English one.
Then the problem has been solved.
I hope this works for you, too.

How to encode or hide iOS app files?

i have an iOS App which loads and .txt file from app's root. If i use iFunBox or any iPhone Browsers i can see that .txt file, how can I hide it? I think it's all about security of this file, encode/decode. Please help me. Any advice, source codes, examples. I'm new here. thanks
The short answer: You can't
The long answer: No matter what you do, you will end up having a copy of the decrypted contents in memory at some point so a crafty cracker will be able to copy the contents out of memory. The best you can do is make it not worth their trouble. This includes using pure C, never storing the contents in one variable (always concat, etc), and encrypting the file with an industry standard encryption like AES-256. Good luck.
I'm not sure that it is possible to protect the file any more than what apple already does. Even if you could, I don't think It would really be worth your trouble to do so unless the .txt file is something that you really need to protect.

How to extract multivolume RAR with Sevenzip.pas?

I am using Progdigy's SevenZip unit to extract RAR files. Works great when RARs are single volume. When I have a multivolume archive then it fails. I am guessing I should add some code to support a callback function which asks for another volume or something, but I am not sure how to do it. Seems it's not supported by SevenZip.pas.
I found something named ArchiveOpenVolumeCallback but no idea how to use it properly. Any help here?

Resources