In my app I have an NSURL which is a file path. If a file or a folder's name contains Russian characters, instead of normal path, something like "/Users/user/Downloads/%D0%94%D0%BE%D0%BC%D0%B0%D1%88%D0%BD%D0%B5%D0%B5 %D0%B7%D0%B0%D0%B4%D0%B0%D0%BD%D0%B8%D0%B5 %D0%BD%D0%B0 %D0%BB%D0%B5%D1%82%D0%BE.doc" is displayed.
Is there a way to fix it?
Thanks in advance!
This is expected behaviour for NSURL, since file urls cannot contain special characters.
What are you trying to do with the URL? If you're using it do get a file from the system it should work. It seems like you're trying to display the path to the user, where and in what context?
Related
I would like to upload a filename with utf-8 characters such as greek, german etc. The upload occurs successfully for both file size and type, unfortunately its filename is being replaced by strange characters. However when english characters for filename are used, there is no problem at all.
Any idea what it might be wrong with utf-8 characters regarding filename for this specific Yii2 widget plugin?
I provide you with the filename being generated for utf-8 characters
and additionally the function source code that produces filename via _slugDefault (added extra line for no special characters).
Regards
I found that it actually depends on the server OS file system language settings and not by the widget itself. So i used the following php function in my controller:
$file_name=iconv('UTF-8', 'language//TRANSLIT',$model->field);
$file->saveAs('files/'.$file_name);
Thanks a lot and i am indeed very happy to solve it on myself!
I need some help for my OS X program.
I need the URL of a file inside the supporting files.
I have an array in which I save URLs from images and add them to a table view and if no images are chosen I want to add a question mark image (it is called "bild.jpg")
This bild.jpg is inside the supporting files but for later use I can't just save the name of the image because the array stores also URLs.
I need to have the URL of that image in the supporting file because it's easier to use the array for image initialization.
Is there a function to get the path or is there a standard path to the supporting files? I already search on the net but couldn't find anything that could help.
You seem to be talking about the application bundle and its resources directory rather than, say, a subdirectory in ~/Library/Application Support/..., in which case you probably want something like:
[[NSBundle mainBundle] URLForResource:#"bild" withExtension:#"jpg"]
(See the documentation for NSBundle.)
I would like to put all the images that I use in my application into the same file and access them by key.
Is it possible to use the .strings file for this?
Assuming you mean you want to put the image names, yes it's possible.
In your code, just use things like [UIImage imageNamed:NSLocalizedString(key, #"")];
Where key is the key that points to the name of your image. Then in the .strings files, point to the right image file based on the locale.
Yes you can! I use it to list website URLs used in my app. This makes it extremely easy to change in the app, if the website URL ever changes. There is no problem with doing this.
I'm trying to write a little Jukebox application in VB Forms, and I need the pathnames of the sound files (\bin\Tracks\"Insert Name Here") to be relative instead of absolute, so that it may work on a different computer to mine. At the moment, I am testing with the simple Soundplayer class, and the single line of code to play a song is this:
My.Computer.Audio.Play("\bin\Tracks\" & txtCurrentlyPlaying.Text)
It works when, instead of \bin\Tracks\, I put the full pathname (C:\Documents And Settings etc.), but not when I try a relative path such as this. Can anybody help?
Thank you for your time.
Nick
Try Path.Combine(Environment.CurrentDirectory, txtCurrentlyPlaying.Text)
I'm using Zend_Pdf to generate PDF files, based on existing PDF templates. The problem is, I can't read any of the templates - I get a "File is not a PDF." error because the first 4 characters in the file are "%???" instead of "%PDF" (I used "head" to check this).
Is this a character encoding problem? I believe the templates are in ISO-8859-1, must I set something in Zend_Pdf_Parser to handle this?
Thanks
to answer my own question, I moved to Perl PDF::Extract and it's working.