Solved

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

Posted on 2008-06-25
7
614 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
paypal ipn to mysql 3 38
md5 password 3 62
PHP Installer 5 24
how to use Initialization Vector for openssl_encrypt() 5 27
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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