Solved

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

Posted on 2008-06-25
7
606 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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 500 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

There are many reasons malware will stay around and continue to grow as a business.  The biggest reason is the expanding customer base.  More than 40% of people who are infected with ransomware, pay the ransom.  That makes ransomware a multi-million…
Healthcare providers, insurance companies and other covered entities trust eFax Corporate to transmit their most sensitive documents. eFax Corporate can help your organization implement a HIPAA compliant cloud faxing solution.
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 viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now