Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Trouble with cyrillic names while using SVN through PHP "exec" command

Posted on 2008-06-25
7
Medium Priority
?
664 Views
Last Modified: 2010-05-18
Im using SVN through PHP "exec" command. File encoding and input parameters - UTF-8. Im sending utf-8 string through "5xec" as well. Command is folder creating:

exec('svn mkdir -m "" --username username --password password '.escapeshellarg(SVN_HOST.$name))

where $name is folder name.

When I use this comand, trying to create folder with english name - folder is created successfully. But when Im trying to create folder with cyrillic name - no luck, "exec" returns nothing. While using the same command through the command line (not through PHP) cyrillic folder is created successfully. I verify encoding using mb_*
environment: WindowsXP, Apache 2.x, PHP5.2.6, svn1.4.6.

Please advice, how to implement creating a folder with cyrillic name in SVN through PHP "exec" command. And provide code sample with encodings you have used (file and input parameters encoding)
0
Comment
Question by:technoparkcorp
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:snrudda
ID: 21864435
As long as you deal with SVN you have to use URL encoding of dir specifications. So replace $name with something like urlencode($name) in your code, this should be the fix.

Please read http://svnbook.red-bean.com/ on the matter with SVN, and http://www.php.net/urlencode on notes on different aspects of PHP URL encoding (you may face one). You may also take a look at SVN function in PHP itself (say, svn_fs_make_dir would be right one for you), but SVN support in PHP still experimental yet.
0
 

Author Comment

by:technoparkcorp
ID: 21865359
No luck. While using urlencode(folder_name), the folder is added, but the name looks like "22 33 22 44 23"
0
 
LVL 4

Expert Comment

by:snrudda
ID: 21865686
Well just use iconv to have your folder name in windows-1251 and not in UTF8 encoding. Use iconv like this:

  ...' . escapeshellarg(urlencode(SVN_HOST.iconv('UTF-8', 'windows-1251', $name)))

Good luck this time!
0
2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

 

Author Comment

by:technoparkcorp
ID: 21876198
No luck again. " 2F EF E0 EF EA E0" - this folder is created, not proper cyrillic name.

Please advice, how to implement creating a folder with cyrillic name in SVN through PHP "exec" command. And provide code sample with encodings you have used (file and input parameters encoding)
0
 
LVL 4

Accepted Solution

by:
snrudda earned 1000 total points
ID: 21882518
Don't have SVN hands but shortly I'd ask you to assign value of exec to file and compare that to string that you given from commend line. I bet you'll get the idea yourself pretty easy.

After all iconv a bit tricky program and PHP iconv support add up some trickiness too. "Play & play & play & don't touch ever after".

PHP SVN support is experimental, and this is PECL extension. Go to see http://www.php.net/svn to get more info on how to install it and use but beware it may be changed.
0
 
LVL 4

Expert Comment

by:snrudda
ID: 21882537
...I mean I don't have access to my SVN right now neither will have it soon, so I'm sad to answer pretty out of my mind. But compare cli command and the one you issue with exec, this will show you the way.
0
 

Author Closing Comment

by:technoparkcorp
ID: 31470497
thank you, that was rather helpful
0

Featured Post

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
This article covers the basics of data encryption, what it is, how it works, and why it's important. If you've ever wondered what goes on when you "encrypt" data, you can look here to build a good foundation for your personal learning.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question