Solved

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

Posted on 2008-06-25
7
609 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WordPress Themes 10 34
PHPStorm debugging issues 1 24
Should I use subdomains or addon domains? 3 35
How to set a countdown by not using the PC time in PHP 36 44
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.
The viewer will learn how to count occurrences of each item in an array.
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.

920 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

13 Experts available now in Live!

Get 1:1 Help Now